Patchwork [remotefilelog-ext,3.6fix] remotefilelog: cope with rename of addchangegroupfiles to _addchangegroupfiles

login
register
mail settings
Submitter Augie Fackler
Date Oct. 15, 2015, 3 p.m.
Message ID <b7bc5d8a625ba414f266.1444921248@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/11104/
State Accepted
Headers show

Comments

Augie Fackler - Oct. 15, 2015, 3 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1444918374 14400
#      Thu Oct 15 10:12:54 2015 -0400
# Node ID b7bc5d8a625ba414f266c288a2c08c1a2f434bfe
# Parent  ae8b11045f8395faea056461fef9c7403f5157b5
remotefilelog: cope with rename of addchangegroupfiles to _addchangegroupfiles

This prevents remotefilelog from breaking with Mercurial 3.6.
Durham Goode - Oct. 19, 2015, 5:17 p.m.
On 10/15/15 8:00 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1444918374 14400
> #      Thu Oct 15 10:12:54 2015 -0400
> # Node ID b7bc5d8a625ba414f266c288a2c08c1a2f434bfe
> # Parent  ae8b11045f8395faea056461fef9c7403f5157b5
> remotefilelog: cope with rename of addchangegroupfiles to _addchangegroupfiles
>
> This prevents remotefilelog from breaking with Mercurial 3.6.
>
Pushed, thanks!

Patch

diff --git a/remotefilelog/__init__.py b/remotefilelog/__init__.py
--- a/remotefilelog/__init__.py
+++ b/remotefilelog/__init__.py
@@ -171,7 +171,11 @@  def onetimeclientsetup(ui):
                                        packermap01[1])
         changegroup.packermap['02'] = (shallowbundle.shallowcg2packer,
                                        packermap02[1])
-    wrapfunction(changegroup, 'addchangegroupfiles', shallowbundle.addchangegroupfiles)
+    if util.safehasattr(changegroup, '_addchangegroupfiles'):
+        fn = '_addchangegroupfiles' # hg >= 3.6
+    else:
+        fn = 'addchangegroupfiles' # hg <= 3.5
+    wrapfunction(changegroup, fn, shallowbundle.addchangegroupfiles)
     wrapfunction(changegroup, 'getchangegroup', shallowbundle.getchangegroup)
 
     def storewrapper(orig, requirements, path, vfstype):