Add a -r option to hg svn. Use with hg svn info to change the mercurial rev.

This commit is contained in:
Jason Ostrander 2009-12-10 13:04:57 -08:00
parent 83d943ae6e
commit f59461883f
3 changed files with 18 additions and 1 deletions

View File

@ -168,6 +168,7 @@ cmdtable = {
('', 'force', False, 'force an operation to happen'),
('', 'username', '', 'username for authentication'),
('', 'password', '', 'password for authentication'),
('r', 'rev', '', 'Mercurial revision'),
],
svncommands._helpgen(),
),

View File

@ -36,7 +36,12 @@ def info(ui, repo, hg_repo_path, **opts):
"""
meta = repo.svnmeta()
hashes = meta.revmap.hashes()
parent = util.parentrev(ui, repo, meta, hashes)
if opts.get('rev'):
parent = repo[opts['rev']]
else:
parent = util.parentrev(ui, repo, meta, hashes)
pn = parent.node()
if pn not in hashes:
ui.status('Not a child of an svn revision.\n')

View File

@ -54,6 +54,17 @@ class UtilityTests(test_util.TestBase):
'rev': 6,
})
self.assertEqual(actual, expected)
hg.update(self.repo, 'default')
u.pushbuffer()
utility_commands.info(u, self.repo, self.wc_path, rev=3)
actual = u.popbuffer()
expected = (expected_info_output %
{'date': '2008-10-08 01:39:05 +0000 (Wed, 08 Oct 2008)',
'repourl': self.repourl,
'branch': 'branches/the_branch',
'rev': 5,
})
self.assertEqual(actual, expected)
def test_parent_output(self):
self._load_fixture_and_fetch('two_heads.svndump')