mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
fixes for running under Mercurial 2.0
This commit is contained in:
parent
1be6c1de4e
commit
0ff4906cfb
@ -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."""
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user