# HG changeset patch # User Jason Ostrander # Date 1260479097 28800 # Node ID 00ecb2bc005cc0d06faee118cd550634cb589590 # Parent 89eda60c90b3f8f9133fbc919c4108f4e9660ca6 Add a -r option to hg svn. Use with hg svn info to change the mercurial rev. diff --git a/hgsubversion/__init__.py b/hgsubversion/__init__.py --- 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(), ), diff --git a/hgsubversion/utility_commands.py b/hgsubversion/utility_commands.py --- 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') diff --git a/tests/test_utility_commands.py b/tests/test_utility_commands.py --- 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')