changegroup: close progress in same function as it's started
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 22 Apr 2015 15:03:09 -0700
changeset 24901 e9edd53770fb
parent 24900 59d1bf41af85
child 24905 4ecbd88cde9a
changegroup: close progress in same function as it's started changegroup.group() and changegroup.generatefiles() both currently start progress (with topic "bundling"), but changegroup.generate() closes the topic. Move the closing to the functions that start the topic, so it's easier to see where the topic is started and closed. This completes a move that seems to have been started in 0b564cf359a7 (bundle-ng: move progress handling out of the linkrev callback, 2013-05-10).
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Tue Apr 28 10:21:04 2015 -0700
+++ b/mercurial/changegroup.py	Wed Apr 22 15:03:09 2015 -0700
@@ -347,6 +347,8 @@
             for c in self.revchunk(revlog, curr, prev, linknode):
                 yield c
 
+        if units is not None:
+            self._progress(msgbundling, None)
         yield self.close()
 
     # filter any nodes that claim to be part of the known set
@@ -360,10 +362,6 @@
         cl = self._changelog
         ml = self._manifest
         reorder = self._reorder
-        progress = self._progress
-
-        # for progress output
-        msgbundling = _('bundling')
 
         clrevorder = {}
         mfs = {} # needed manifests
@@ -388,7 +386,6 @@
             size += len(chunk)
             yield chunk
         self._verbosenote(_('%8.i (changelog)\n') % size)
-        progress(msgbundling, None)
 
         # Callback for the manifest, used to collect linkrevs for filelog
         # revisions.
@@ -414,7 +411,6 @@
             size += len(chunk)
             yield chunk
         self._verbosenote(_('%8.i (manifests)\n') % size)
-        progress(msgbundling, None)
 
         mfs.clear()
         clrevs = set(cl.rev(x) for x in clnodes)
@@ -435,7 +431,6 @@
             yield chunk
 
         yield self.close()
-        progress(msgbundling, None)
 
         if clnodes:
             repo.hook('outgoing', node=hex(clnodes[0]), source=source)
@@ -473,6 +468,7 @@
                     size += len(chunk)
                     yield chunk
                 self._verbosenote(_('%8.i  %s\n') % (size, fname))
+        progress(msgbundling, None)
 
     def deltaparent(self, revlog, rev, p1, p2, prev):
         return prev