[PATCH 3 of 5 (4 more to go)] localrepo: move the changegroupinfo method in changegroup module

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Wed Apr 2 12:59:04 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1396386814 25200
#      Tue Apr 01 14:13:34 2014 -0700
# Node ID b5bc4afcee8a99dc6c5480c293a9557ca4234ca6
# Parent  51dedd9e405716d7818dcf0f2636b51da5165243
localrepo: move the changegroupinfo method in changegroup module

This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had a single caller... already in this changegroup module.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -427,10 +427,19 @@ class bundle10(object):
         yield delta
     def builddeltaheader(self, node, p1n, p2n, basenode, linknode):
         # do nothing with basenode, it is implicitly the previous one in HG10
         return struct.pack(self.deltaheader, node, p1n, p2n, linknode)
 
+def _changegroupinfo(repo, nodes, source):
+    if repo.ui.verbose or source == 'bundle':
+        repo.ui.status(_("%d changesets found\n") % len(nodes))
+    if repo.ui.debugflag:
+        repo.ui.debug("list of changesets:\n")
+        for node in nodes:
+            repo.ui.debug("%s\n" % hex(node))
+
+
 def getsubset(repo, outgoing, bundler, source, fastpath=False):
     repo = repo.unfiltered()
     commonrevs = outgoing.common
     csets = outgoing.missing
     heads = outgoing.missingheads
@@ -440,8 +449,8 @@ def getsubset(repo, outgoing, bundler, s
     heads.sort()
     fastpathlinkrev = fastpath or (
             repo.filtername is None and heads == sorted(repo.heads()))
 
     repo.hook('preoutgoing', throw=True, source=source)
-    repo.changegroupinfo(csets, source)
+    _changegroupinfo(repo, csets, source)
     gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source)
     return unbundle10(util.chunkbuffer(gengroup), 'UN')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1677,18 +1677,10 @@ class localrepository(object):
         pass
 
     def push(self, remote, force=False, revs=None, newbranch=False):
         return exchange.push(self, remote, force, revs, newbranch)
 
-    def changegroupinfo(self, nodes, source):
-        if self.ui.verbose or source == 'bundle':
-            self.ui.status(_("%d changesets found\n") % len(nodes))
-        if self.ui.debugflag:
-            self.ui.debug("list of changesets:\n")
-            for node in nodes:
-                self.ui.debug("%s\n" % hex(node))
-
     def changegroupsubset(self, roots, heads, source):
         """Compute a changegroup consisting of all the nodes that are
         descendants of any of the roots and ancestors of any of the heads.
         Return a chunkbuffer object whose read() method will return
         successive changegroup chunks.


More information about the Mercurial-devel mailing list