Update wrapping to work with Mercurial 3.6

This commit is contained in:
Durham Goode 2015-10-26 15:47:53 -07:00
parent a6e7769d60
commit 2d8cf7b54e

View File

@ -75,7 +75,11 @@ def uisetup(ui):
wireproto.commands['pushkey'] = (wireproto.pushkey, 'namespace key old new')
wrapfunction(bookmarks, 'updatefromremote', updatefromremote)
wrapfunction(changegroup, 'addchangegroup', addchangegroup)
if util.safehasattr(changegroup, 'addchangegroup'):
wrapfunction(changegroup, 'addchangegroup', addchangegroup)
else:
# Mercurial 3.6+
wrapfunction(changegroup.cg1unpacker, 'apply', changegroupapply)
# Record revlog writes
def writeentry(orig, self, transaction, ifh, dfh, entry, data, link, offset):
@ -213,6 +217,13 @@ def addchangegroup(orig, *args, **kwargs):
else:
return orig(*args, **kwargs)
def changegroupapply(orig, *args, **kwargs):
repo = args[1]
if repo.ui.configbool("hgsql", "enabled"):
return executewithsql(repo, orig, True, *args, **kwargs)
else:
return orig(*args, **kwargs)
def _localphasemove(orig, pushop, *args, **kwargs):
repo = pushop.repo
if repo.ui.configbool("hgsql", "enabled"):