diff mercurial/bundlerepo.py @ 21063:7ca4f2049d3b

bundle2: move `readbundle` into the `exchange` module The `readbundle` function is going to understand the bundle2 header. We move the function to a more suitable place before making any other changes.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 14 Apr 2014 15:33:50 -0400
parents 4fdd1172d37e
children 4d9d490d7bbe
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Mon Apr 14 14:46:32 2014 -0400
+++ b/mercurial/bundlerepo.py	Mon Apr 14 15:33:50 2014 -0400
@@ -14,7 +14,7 @@
 from node import nullid
 from i18n import _
 import os, tempfile, shutil
-import changegroup, util, mdiff, discovery, cmdutil, scmutil
+import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
 import localrepo, changelog, manifest, filelog, revlog, error
 
 class bundlerevlog(revlog.revlog):
@@ -202,7 +202,7 @@
 
         self.tempfile = None
         f = util.posixfile(bundlename, "rb")
-        self.bundle = changegroup.readbundle(f, bundlename)
+        self.bundle = exchange.readbundle(f, bundlename)
         if self.bundle.compressed():
             fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
                                             suffix=".hg10un")
@@ -220,7 +220,7 @@
                 fptemp.close()
 
             f = self.vfs.open(self.tempfile, mode="rb")
-            self.bundle = changegroup.readbundle(f, bundlename, self.vfs)
+            self.bundle = exchange.readbundle(f, bundlename, self.vfs)
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}