evolve: add progress support for --continue
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 23 Apr 2019 11:07:28 -0700
changeset 4603 8cc329d705f9
parent 4602 98387ccf0b79
child 4604 eb4ae1f71cf4
evolve: add progress support for --continue The progress starts where it left off when the previous command ran into merge conflicts.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-progress.t
--- a/hgext3rd/evolve/evolvecmd.py	Tue Apr 23 10:56:42 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Apr 23 11:07:28 2019 -0700
@@ -1649,7 +1649,7 @@
         if not evolvestate:
             raise error.Abort(_('no interrupted evolve to continue'))
         evolvestate.load()
-        continueevolve(ui, repo, evolvestate, None)
+        continueevolve(ui, repo, evolvestate)
         if evolvestate['command'] != 'evolve':
             evolvestate.delete()
             return
@@ -1895,7 +1895,7 @@
             raise error.Abort(_("unable to abort interrupted evolve, use 'hg "
                                 "evolve --stop' to stop evolve"))
 
-def continueevolve(ui, repo, evolvestate, progresscb):
+def continueevolve(ui, repo, evolvestate):
     """logic for handling of `hg evolve --continue`"""
 
     with repo.wlock(), repo.lock():
@@ -1907,7 +1907,7 @@
         elif evolvestate['category'] == 'phasedivergent':
             _completephasedivergent(ui, repo, evolvestate)
         elif evolvestate['category'] == 'contentdivergent':
-            _continuecontentdivergent(ui, repo, evolvestate, progresscb)
+            _continuecontentdivergent(ui, repo, evolvestate, None)
         else:
             repo.ui.status(_("continuing interrupted '%s' resolution is not yet"
                              " supported\n") % evolvestate['category'])
@@ -1917,6 +1917,14 @@
         if evolvestate['command'] != 'evolve':
             return
 
+        # Progress handling
+        seen = 1
+        count = len(evolvestate['revs'])
+
+        def progresscb():
+            compat.progress(ui, _('evolve'), seen, unit=_('changesets'),
+                            total=count)
+
         category = evolvestate['category']
         confirm = evolvestate['confirm']
         unfi = repo.unfiltered()
@@ -1948,6 +1956,7 @@
                     lastsolved = newnode[1]
                 else:
                     evolvestate['skippedrevs'].append(curctx.node())
+            seen += 1
 
 def _continuecontentdivergent(ui, repo, evolvestate, progresscb):
     """function to continue the interrupted content-divergence resolution."""
--- a/tests/test-evolve-progress.t	Tue Apr 23 10:56:42 2019 -0700
+++ b/tests/test-evolve-progress.t	Tue Apr 23 11:07:28 2019 -0700
@@ -156,6 +156,7 @@
   move:[6] third
   atop:[11] second
   hg rebase -r 53c0008d98a0 -d 60a86497fbfe
+  evolve: 2/3 changesets (66.67%)
     unmatched files in other:
      b
   resolving manifests
@@ -173,6 +174,7 @@
   invalid branchheads cache (served): tip differs
   move:[7] fourth
   hg rebase -r 385376d04062 -d b2de95304e32
+  evolve: 3/3 changesets (100.00%)
   resolving manifests
    branchmerge: True, force: True, partial: False
    ancestor: 53c0008d98a0, local: b2de95304e32+, remote: 385376d04062