Skip to content

Commit

Permalink
Merge branch 'bug2404'
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Nov 27, 2012
2 parents 7658201 + 541070b commit 7138f59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/changes/hgpoller.py
Expand Up @@ -246,7 +246,7 @@ def _processChanges(self, unused_output):
return
if current is None:
# we could have used current = -1 convention as well (as hg does)
revrange = '0:%d' % head
revrange = '%d:%d' % (head, head)
else:
revrange = '%d:%s' % (current + 1, head)

Expand Down
36 changes: 7 additions & 29 deletions master/buildbot/test/unit/test_changes_hgpoller.py
Expand Up @@ -82,26 +82,17 @@ def test_poll_initial(self):
'ssh://example.com/foo/baz')
.path('/some/dir'),
gpo.Expect('hg', 'heads', 'default', '--template={rev}\n')
.path('/some/dir').stdout("1"),
gpo.Expect('hg', 'log', '-b', 'default', '-r', '0:1',
.path('/some/dir').stdout("73591"),
gpo.Expect('hg', 'log', '-b', 'default', '-r', '73591:73591', # only fetches that head
'--template={rev}:{node}\\n')
.path('/some/dir').stdout(os.linesep.join(['0:64a5dc2', '1:4423cdb'])),
gpo.Expect('hg', 'log', '-r', '64a5dc2',
'--template={date|hgdate}\n{author}\n{files}\n{desc|strip}')
.path('/some/dir').stdout(os.linesep.join([
'1273258009.0 -7200',
'Joe Test <joetest@example.org>',
'file1 file2',
'Multi-line',
'Comment for rev 0',
''])),
.path('/some/dir').stdout(os.linesep.join(['73591:4423cdb'])),
gpo.Expect('hg', 'log', '-r', '4423cdb',
'--template={date|hgdate}\n{author}\n{files}\n{desc|strip}')
.path('/some/dir').stdout(os.linesep.join([
'1273258100.0 -7200',
'Bob Test <bobtest@example.org>',
'file1 dir/file2',
'This is rev 1',
'This is rev 73591',
''])),
)

Expand All @@ -110,22 +101,9 @@ def test_poll_initial(self):

# check the results
def check_changes(_):
self.assertEqual(len(self.changes_added), 2)
self.assertEqual(len(self.changes_added), 1)

change = self.changes_added[0]
self.assertEqual(change['revision'], '64a5dc2')
self.assertEqual(change['author'],
'Joe Test <joetest@example.org>')
self.assertEqual(change['when_timestamp'],
epoch2datetime(1273258009)),
self.assertEqual(change['files'], ['file1', 'file2'])
self.assertEqual(change['src'], 'hg')
self.assertEqual(change['branch'], 'default')
self.assertEqual(change['comments'],
os.linesep.join(('Multi-line',
'Comment for rev 0')))

change = self.changes_added[1]
self.assertEqual(change['revision'], '4423cdb')
self.assertEqual(change['author'],
'Bob Test <bobtest@example.org>')
Expand All @@ -134,10 +112,10 @@ def check_changes(_):
self.assertEqual(change['files'], ['file1', 'dir/file2'])
self.assertEqual(change['src'], 'hg')
self.assertEqual(change['branch'], 'default')
self.assertEqual(change['comments'], 'This is rev 1')
self.assertEqual(change['comments'], 'This is rev 73591')

d.addCallback(check_changes)
d.addCallback(self.check_current_rev(1))
d.addCallback(self.check_current_rev(73591))
return d

def check_current_rev(self, wished):
Expand Down

0 comments on commit 7138f59

Please sign in to comment.