changeset 23895:cda18ded2c48

changegroup.writebundle: provide ui The next diff will add support for writing bundle2 files to writebundle, but the bundle2 generator wants access to a ui object. This changes the signature and callsites to pass one in.
author Eric Sumner <ericsumner@fb.com>
date Thu, 15 Jan 2015 14:39:41 -0800
parents f388ceae2250
children becfecaf9087
files hgext/shelve.py mercurial/bundlerepo.py mercurial/changegroup.py mercurial/commands.py mercurial/httppeer.py mercurial/repair.py
diffstat 6 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/hgext/shelve.py	Thu Jan 15 14:39:41 2015 -0800
@@ -43,6 +43,7 @@
         self.repo = repo
         self.name = name
         self.vfs = scmutil.vfs(repo.join('shelved'))
+        self.ui = self.repo.ui
         if filetype:
             self.fname = name + '.' + filetype
         else:
@@ -82,7 +83,7 @@
         return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root,
                                            self.vfs.join(self.fname))
     def writebundle(self, cg):
-        changegroup.writebundle(cg, self.fname, 'HG10UN', self.vfs)
+        changegroup.writebundle(self.ui, cg, self.fname, 'HG10UN', self.vfs)
 
 class shelvedstate(object):
     """Handle persistence during unshelving operations.
--- a/mercurial/bundlerepo.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/mercurial/bundlerepo.py	Thu Jan 15 14:39:41 2015 -0800
@@ -410,7 +410,7 @@
         else:
             cg = other.changegroupsubset(incoming, rheads, 'incoming')
         bundletype = localrepo and "HG10BZ" or "HG10UN"
-        fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
+        fname = bundle = changegroup.writebundle(ui, cg, bundlename, bundletype)
         # keep written bundle?
         if bundlename:
             bundle = None
--- a/mercurial/changegroup.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/mercurial/changegroup.py	Thu Jan 15 14:39:41 2015 -0800
@@ -79,7 +79,7 @@
 # hgweb uses this list to communicate its preferred type
 bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
 
-def writebundle(cg, filename, bundletype, vfs=None):
+def writebundle(ui, cg, filename, bundletype, vfs=None):
     """Write a bundle file and return its filename.
 
     Existing files will not be overwritten.
--- a/mercurial/commands.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/mercurial/commands.py	Thu Jan 15 14:39:41 2015 -0800
@@ -1217,7 +1217,7 @@
         scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
         return 1
 
-    changegroup.writebundle(cg, fname, bundletype)
+    changegroup.writebundle(ui, cg, fname, bundletype)
 
 @command('cat',
     [('o', 'output', '',
@@ -2165,7 +2165,7 @@
     bundletype = btypes.get(bundletype)
     if bundletype not in changegroup.bundletypes:
         raise util.Abort(_('unknown bundle type specified with --type'))
-    changegroup.writebundle(bundle, bundlepath, bundletype)
+    changegroup.writebundle(ui, bundle, bundlepath, bundletype)
 
 @command('debugignore', [], '')
 def debugignore(ui, repo, *values, **opts):
--- a/mercurial/httppeer.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/mercurial/httppeer.py	Thu Jan 15 14:39:41 2015 -0800
@@ -193,7 +193,7 @@
                 type = x
                 break
 
-        tempname = changegroup.writebundle(cg, None, type)
+        tempname = changegroup.writebundle(self.ui, cg, None, type)
         fp = httpconnection.httpsendfile(self.ui, tempname, "rb")
         headers = {'Content-Type': 'application/mercurial-0.1'}
 
--- a/mercurial/repair.py	Fri Jan 16 16:25:30 2015 -0800
+++ b/mercurial/repair.py	Thu Jan 15 14:39:41 2015 -0800
@@ -31,7 +31,7 @@
         bundletype = "HG10BZ"
     else:
         bundletype = "HG10UN"
-    return changegroup.writebundle(cg, name, bundletype, vfs)
+    return changegroup.writebundle(repo.ui, cg, name, bundletype, vfs)
 
 def _collectfiles(repo, striprev):
     """find out the filelogs affected by the strip"""