Patchwork [6,of,6] changegroup: close progress in same function as it's started

login
register
mail settings
Submitter Martin von Zweigbergk
Date May 1, 2015, 10:50 p.m.
Message ID <92720f8f4629595026b9.1430520644@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8831/
State Accepted
Headers show

Comments

Martin von Zweigbergk - May 1, 2015, 10:50 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1429740189 25200
#      Wed Apr 22 15:03:09 2015 -0700
# Node ID 92720f8f4629595026b920dd3067997f9e56a411
# Parent  936eff6f83d7b97f7dffe0373980cf26aecbc645
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).
Matt Mackall - May 1, 2015, 11:01 p.m.
On Fri, 2015-05-01 at 15:50 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1429740189 25200
> #      Wed Apr 22 15:03:09 2015 -0700
> # Node ID 92720f8f4629595026b920dd3067997f9e56a411
> # Parent  936eff6f83d7b97f7dffe0373980cf26aecbc645
> changegroup: close progress in same function as it's started

These are queued for default, thanks.

Patch

diff -r 936eff6f83d7 -r 92720f8f4629 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