shelve: move changegroup generation inside writebundle
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 01 Oct 2015 15:09:32 -0700
changeset 26506 edecf059fda6
parent 26505 6086ddc1fdc6
child 26507 ae29cffa05db
shelve: move changegroup generation inside writebundle We will generate different changegroup if general delta is enabled so we gather this in the lower level function. There wasn't any good reason to have it in the main code anyway.
hgext/shelve.py
--- a/hgext/shelve.py	Tue Sep 29 17:14:30 2015 -0700
+++ b/hgext/shelve.py	Thu Oct 01 15:09:32 2015 -0700
@@ -105,7 +105,8 @@
     def bundlerepo(self):
         return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root,
                                            self.vfs.join(self.fname))
-    def writebundle(self, cg):
+    def writebundle(self, bases, node):
+        cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve')
         changegroup.writebundle(self.ui, cg, self.fname, 'HG10BZ', self.vfs)
 
 class shelvedstate(object):
@@ -291,8 +292,7 @@
             return 1
 
         bases = list(publicancestors(repo[node]))
-        cg = changegroup.changegroupsubset(repo, bases, [node], 'shelve')
-        shelvedfile(repo, name, 'hg').writebundle(cg)
+        shelvedfile(repo, name, 'hg').writebundle(bases, node)
         cmdutil.export(repo, [node],
                        fp=shelvedfile(repo, name, 'patch').opener('wb'),
                        opts=mdiff.diffopts(git=True))