Mercurial > hgsubversion
changeset 503:00ecb2bc005c
Add a -r option to hg svn. Use with hg svn info to change the mercurial rev.
author | Jason Ostrander <jason@sentilla.com> |
---|---|
date | Thu, 10 Dec 2009 13:04:57 -0800 |
parents | 89eda60c90b3 |
children | bc117ea4c95a |
files | hgsubversion/__init__.py hgsubversion/utility_commands.py tests/test_utility_commands.py |
diffstat | 3 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/__init__.py +++ b/hgsubversion/__init__.py @@ -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(), ),
--- a/hgsubversion/utility_commands.py +++ b/hgsubversion/utility_commands.py @@ -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')
--- a/tests/test_utility_commands.py +++ b/tests/test_utility_commands.py @@ -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')