evolve: reduce scope of progress-related variables
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 23 Apr 2019 10:56:42 -0700
changeset 4602 98387ccf0b79
parent 4601 e5aa1e23d146
child 4603 8cc329d705f9
evolve: reduce scope of progress-related variables
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Tue Apr 23 10:49:47 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 23 10:56:42 2019 -0700
@@ -1643,15 +1643,6 @@
     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
     troubled = set(repo.revs('troubled()'))
 
-    # Progress handling
-    seen = 1
-    count = allopt and len(troubled) or 1
-    showprogress = allopt or revopt
-
-    def progresscb():
-        if showprogress:
-            compat.progress(ui, _('evolve'), seen, unit=_('changesets'), total=count)
-
     evolvestate = state.cmdstate(repo)
     # Continuation handling
     if contopt:
@@ -1690,6 +1681,16 @@
     else:
         cmdutil.bailifchanged(repo)
 
+        # Progress handling
+        seen = 1
+        count = allopt and len(troubled) or 1
+        showprogress = allopt or revopt
+
+        def progresscb():
+            if showprogress:
+                compat.progress(ui, _('evolve'), seen, unit=_('changesets'),
+                                total=count)
+
         revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
 
         # Case: when wdir parent is obsolete and args passed.