[PATCH 1 of 2] histedit: report progress from verifyactions (issue5341)

timeless timeless at fmr.im
Wed Aug 24 17:31:18 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1472058828 0
#      Wed Aug 24 17:13:48 2016 +0000
# Node ID 7b0afc5eacdc0662ed0fcde8eb58c8e599a7f695
# Parent  b1809f5d7630a3fff0fa715bbd30dba0f07672a8
# Available At https://bitbucket.org/timeless/mercurial-crew
#              hg pull https://bitbucket.org/timeless/mercurial-crew -r 7b0afc5eacdc
histedit: report progress from verifyactions (issue5341)

With this change, I get progress like this:
checking [==>                                                         ]  39/726 5m01s

And sadly, those time estimates are accurate.
The verifyactions step is *much* slower than the editing stage:
editing [===>                                                         ]  49/726 1m47s

diff -r b1809f5d7630 -r 7b0afc5eacdc hgext/histedit.py
--- a/hgext/histedit.py	Mon Aug 15 20:39:33 2016 -0700
+++ b/hgext/histedit.py	Wed Aug 24 17:13:48 2016 +0000
@@ -1382,14 +1382,14 @@
 
 def warnverifyactions(ui, repo, actions, state, ctxs):
     try:
-        verifyactions(actions, state, ctxs)
+        verifyactions(ui, actions, state, ctxs)
     except error.ParseError:
         if repo.vfs.exists('histedit-last-edit.txt'):
             ui.warn(_('warning: histedit rules saved '
                       'to: .hg/histedit-last-edit.txt\n'))
         raise
 
-def verifyactions(actions, state, ctxs):
+def verifyactions(ui, actions, state, ctxs):
     """Verify that there exists exactly one action per given changeset and
     other constraints.
 
@@ -1399,7 +1399,12 @@
     expected = set(c.hex() for c in ctxs)
     seen = set()
     prev = None
+    rulelen = len(actions)
+    i = 0
     for action in actions:
+        i += 1
+        ui.progress(_("checking"), i, 'task',
+                    _('changes'), rulelen)
         action.verify(prev)
         prev = action
         constraints = action.constraints()
@@ -1426,6 +1431,7 @@
                         'duplicated command for changeset %s') %
                         ha[:12])
             seen.add(ha)
+    ui.progress(_("checking"), None)
     missing = sorted(expected - seen)  # sort to stabilize output
 
     if state.repo.ui.configbool('histedit', 'dropmissing'):


More information about the Mercurial-devel mailing list