bundle2.getunbundler: rename "header" to "magicstring"
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 07 Apr 2015 14:14:27 -0700
changeset 25640 39f0064a3079
parent 25639 7125225a5287
child 25641 c0bdfe87b245
bundle2.getunbundler: rename "header" to "magicstring" This is more consistent with the name used in the bundler class. Thanks goes to Martin von Zweigbergk for pointing this out.
mercurial/bundle2.py
mercurial/exchange.py
--- a/mercurial/bundle2.py	Wed Jun 24 12:37:55 2015 -0500
+++ b/mercurial/bundle2.py	Tue Apr 07 14:14:27 2015 -0700
@@ -597,18 +597,18 @@
         if util.safehasattr(self._fp, 'close'):
             return self._fp.close()
 
-def getunbundler(ui, fp, header=None):
-    """return a valid unbundler object for a given header"""
-    if header is None:
-        header = changegroup.readexactly(fp, 4)
-    magic, version = header[0:2], header[2:4]
+def getunbundler(ui, fp, magicstring=None):
+    """return a valid unbundler object for a given magicstring"""
+    if magicstring is None:
+        magicstring = changegroup.readexactly(fp, 4)
+    magic, version = magicstring[0:2], magicstring[2:4]
     if magic != 'HG':
         raise util.Abort(_('not a Mercurial bundle'))
     unbundlerclass = formatmap.get(version)
     if unbundlerclass is None:
         raise util.Abort(_('unknown bundle version %s') % version)
     unbundler = unbundlerclass(ui, fp)
-    indebug(ui, 'start processing of %s stream' % header)
+    indebug(ui, 'start processing of %s stream' % magicstring)
     return unbundler
 
 class unbundle20(unpackermixin):
--- a/mercurial/exchange.py	Wed Jun 24 12:37:55 2015 -0500
+++ b/mercurial/exchange.py	Tue Apr 07 14:14:27 2015 -0700
@@ -36,7 +36,7 @@
             alg = changegroup.readexactly(fh, 2)
         return changegroup.cg1unpacker(fh, alg)
     elif version.startswith('2'):
-        return bundle2.getunbundler(ui, fh, header=magic + version)
+        return bundle2.getunbundler(ui, fh, magicstring=magic + version)
     else:
         raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))