# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1375727251 -7200 # Node ID ada2400241c4e8b7a10c4e15d662532224f65d52 # Parent 3df6ed4e75613c1c50e2336f08ab5c0d91f33359 fixes for running under Mercurial 2.0 diff --git a/hgsubversion/util.py b/hgsubversion/util.py --- a/hgsubversion/util.py +++ b/hgsubversion/util.py @@ -8,6 +8,7 @@ from mercurial import cmdutil from mercurial import error from mercurial import hg from mercurial import node +from mercurial import repair from mercurial import util as hgutil try: @@ -84,6 +85,14 @@ def islocalrepo(url): path = path.rsplit('/', 1)[0] return False +def strip(ui, repo, changesets, *args , **opts): + try: + repair.strip(ui, repo, changesets, *args, **opts) + except TypeError: + # only 2.1.2 and later allow strip to take a list of nodes + for changeset in changesets: + repair.strip(ui, repo, changeset, *args, **opts) + def version(ui): """Return version information if available.""" diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -303,7 +303,7 @@ def push(repo, dest, force, revs): util.swap_out_encoding() # strip the original changesets since the push was successful - repair.strip(ui, repo, outgoing, "all") + util.strip(ui, repo, outgoing, "all") finally: try: # It's always safe to delete the temporary commits. @@ -315,8 +315,7 @@ def push(repo, dest, force, revs): parent = repo[None].p1() if parent.node() in temporary_commits: hg.update(repo, parent.p1().node()) - for n in temporary_commits: - repair.strip(ui, repo, n, backup=None) + util.strip(ui, repo, temporary_commits, backup=None) finally: util.swap_out_encoding(old_encoding) return 1 # so we get a sane exit status, see hg's commands.push diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -17,6 +17,8 @@ from mercurial import node from mercurial import revlog from mercurial import util as hgutil +from hgsubversion import util + import time @@ -594,10 +596,12 @@ class PushTests(test_util.TestBase): # verify that the first commit is pushed, and the second is not commit2 = self.repo['tip'] self.assertEqual(commit2.files(), ['delta', ]) - self.assertTrue(commit2.mutable()) + self.assertEqual(util.getsvnrev(commit2), None) commit1 = commit2.parents()[0] self.assertEqual(commit1.files(), ['gamma', ]) - self.assertFalse(commit1.mutable()) + prefix = 'svn:' + self.repo.svnmeta().uuid + self.assertEqual(util.getsvnrev(commit1), + prefix + '/branches/the_branch@5') def test_push_two_that_modify_same_file(self): ''' @@ -623,10 +627,14 @@ class PushTests(test_util.TestBase): # verify that both commits are pushed commit1 = self.repo['tip'] self.assertEqual(commit1.files(), ['delta', 'gamma']) - self.assertFalse(commit1.mutable()) + + prefix = 'svn:' + self.repo.svnmeta().uuid + self.assertEqual(util.getsvnrev(commit1), + prefix + '/branches/the_branch@6') commit2 = commit1.parents()[0] self.assertEqual(commit2.files(), ['gamma']) - self.assertFalse(commit2.mutable()) + self.assertEqual(util.getsvnrev(commit2), + prefix + '/branches/the_branch@5') def test_push_in_subdir(self, commit=True): repo = self.repo