diff hgext/progress.py @ 19619:4694ccd5d994

progress: stop getting stuck in a nested topic during a long inner step Convert, for example, has loops like this: for revision in source_repo: progress(revisions) for file in revision: progresss(file) Prior to this change, we would start showing the file-level progress when we encountered a big revision, and then we'd get stuck in showing file-progress instead of revision progress, often producing many many instantly-completing progress bars rather than the actually-helpful top-level revisions bar.
author Augie Fackler <raf@durin42.com>
date Fri, 23 Aug 2013 13:28:18 -0400
parents b4744c3b991e
children be4270d27a7e
line wrap: on
line diff
--- a/hgext/progress.py	Thu Aug 15 21:36:53 2013 -0400
+++ b/hgext/progress.py	Fri Aug 23 13:28:18 2013 -0400
@@ -239,6 +239,13 @@
             # this one are also closed
             if topic in self.topics:
                 self.topics = self.topics[:self.topics.index(topic)]
+                # reset the last topic to the one we just unwound to,
+                # so that higher-level topics will be stickier than
+                # lower-level topics
+                if self.topics:
+                    self.lasttopic = self.topics[-1]
+                else:
+                    self.lasttopic = None
         else:
             if topic not in self.topics:
                 self.starttimes[topic] = now