mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
pull: wrap exchange.pull if localrepository.pull isn't available
Mercurial rev 20bb6e6b4dc5 removed localrepository.pull. We don't do it the other way round (wrap pull if exchange.pull is available) because that's been available with a different signature since Mercurial 3.0.
This commit is contained in:
parent
15bce1949a
commit
04641fe869
@ -146,6 +146,9 @@ def extsetup(ui):
|
||||
if not hgutil.safehasattr(localrepo.localrepository, 'push'):
|
||||
# Mercurial >= 3.2
|
||||
extensions.wrapfunction(exchange, 'push', wrappers.exchangepush)
|
||||
if not hgutil.safehasattr(localrepo.localrepository, 'pull'):
|
||||
# Mercurial >= 3.2
|
||||
extensions.wrapfunction(exchange, 'pull', wrappers.exchangepull)
|
||||
|
||||
helpdir = os.path.join(os.path.dirname(__file__), 'help')
|
||||
|
||||
|
@ -103,9 +103,11 @@ def generate_repo_class(ui, repo):
|
||||
def push(self, remote, force=False, revs=None, newbranch=None):
|
||||
return wrappers.push(self, remote, force, revs)
|
||||
|
||||
@remotesvn
|
||||
def pull(self, remote, heads=[], force=False):
|
||||
return wrappers.pull(self, remote, heads, force)
|
||||
if hgutil.safehasattr(localrepo.localrepository, 'pull'):
|
||||
# Mercurial < 3.2
|
||||
@remotesvn
|
||||
def pull(self, remote, heads=[], force=False):
|
||||
return wrappers.pull(self, remote, heads, force)
|
||||
|
||||
@remotesvn
|
||||
def findoutgoing(self, remote, base=None, heads=None, force=False):
|
||||
|
@ -518,6 +518,19 @@ def pull(repo, source, heads=[], force=False):
|
||||
else:
|
||||
ui.status("pulled %d revisions\n" % revisions)
|
||||
|
||||
def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=()):
|
||||
capable = getattr(remote, 'capable', lambda x: False)
|
||||
if capable('subversion'):
|
||||
pullop = exchange.pulloperation(repo, remote, heads, force,
|
||||
bookmarks=bookmarks)
|
||||
try:
|
||||
pullop.cgresult = pull(repo, remote, heads, force)
|
||||
return pullop
|
||||
finally:
|
||||
pullop.releasetransaction()
|
||||
else:
|
||||
return orig(repo, remote, heads, force, bookmarks=bookmarks)
|
||||
|
||||
def rebase(orig, ui, repo, **opts):
|
||||
"""rebase current unpushed revisions onto the Subversion head
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user