bundle2: add a ui argument to readbundle
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 14 Apr 2014 15:45:30 -0400
changeset 21064 4d9d490d7bbe
parent 21063 7ca4f2049d3b
child 21065 f9a9a6d63e89
bundle2: add a ui argument to readbundle The bundle2 unbundler needs a ui argument. We are now passing this information to `readbundle`.
hgext/shelve.py
mercurial/bundlerepo.py
mercurial/commands.py
mercurial/exchange.py
mercurial/repair.py
mercurial/wireproto.py
--- a/hgext/shelve.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/hgext/shelve.py	Mon Apr 14 15:45:30 2014 -0400
@@ -71,7 +71,7 @@
     def applybundle(self):
         fp = self.opener()
         try:
-            gen = exchange.readbundle(fp, self.fname, self.vfs)
+            gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs)
             changegroup.addchangegroup(self.repo, gen, 'unshelve',
                                        'bundle:' + self.vfs.join(self.fname))
         finally:
--- a/mercurial/bundlerepo.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/mercurial/bundlerepo.py	Mon Apr 14 15:45:30 2014 -0400
@@ -202,7 +202,7 @@
 
         self.tempfile = None
         f = util.posixfile(bundlename, "rb")
-        self.bundle = exchange.readbundle(f, bundlename)
+        self.bundle = exchange.readbundle(ui, 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 = exchange.readbundle(f, bundlename, self.vfs)
+            self.bundle = exchange.readbundle(ui, f, bundlename, self.vfs)
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
--- a/mercurial/commands.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/mercurial/commands.py	Mon Apr 14 15:45:30 2014 -0400
@@ -1736,7 +1736,7 @@
     """lists the contents of a bundle"""
     f = hg.openpath(ui, bundlepath)
     try:
-        gen = exchange.readbundle(f, bundlepath)
+        gen = exchange.readbundle(ui, f, bundlepath)
         if all:
             ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
 
@@ -5807,7 +5807,7 @@
     try:
         for fname in fnames:
             f = hg.openpath(ui, fname)
-            gen = exchange.readbundle(f, fname)
+            gen = exchange.readbundle(ui, f, fname)
             modheads = changegroup.addchangegroup(repo, gen, 'unbundle',
                                                   'bundle:' + fname)
     finally:
--- a/mercurial/exchange.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/mercurial/exchange.py	Mon Apr 14 15:45:30 2014 -0400
@@ -11,7 +11,7 @@
 import util, scmutil, changegroup, base85
 import discovery, phases, obsolete, bookmarks, bundle2
 
-def readbundle(fh, fname, vfs=None):
+def readbundle(ui, fh, fname, vfs=None):
     header = changegroup.readexactly(fh, 6)
 
     if not fname:
--- a/mercurial/repair.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/mercurial/repair.py	Mon Apr 14 15:45:30 2014 -0400
@@ -147,7 +147,7 @@
         if saveheads or savebases:
             ui.note(_("adding branch\n"))
             f = vfs.open(chgrpfile, "rb")
-            gen = exchange.readbundle(f, chgrpfile, vfs)
+            gen = exchange.readbundle(ui, f, chgrpfile, vfs)
             if not repo.ui.verbose:
                 # silence internal shuffling chatter
                 repo.ui.pushbuffer()
--- a/mercurial/wireproto.py	Mon Apr 14 15:33:50 2014 -0400
+++ b/mercurial/wireproto.py	Mon Apr 14 15:45:30 2014 -0400
@@ -766,7 +766,7 @@
         try:
             proto.getfile(fp)
             fp.seek(0)
-            gen = exchange.readbundle(fp, None)
+            gen = exchange.readbundle(repo.ui, fp, None)
             r = exchange.unbundle(repo, gen, their_heads, 'serve',
                                   proto._client())
             return pushres(r)