changeset 27451:f209c85183a7

histedit: add progress support
author timeless <timeless@mozdev.org>
date Fri, 18 Dec 2015 06:19:22 +0000
parents 467338e690f8
children 5df74b2f296d
files hgext/histedit.py tests/test-histedit-fold.t
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sun Dec 20 18:38:21 2015 +0900
+++ b/hgext/histedit.py	Fri Dec 18 06:19:22 2015 +0000
@@ -1082,15 +1082,21 @@
         if action.verb == 'fold' and nextact and nextact.verb == 'fold':
             state.actions[idx].__class__ = _multifold
 
+    total = len(state.actions)
+    pos = 0
     while state.actions:
         state.write()
         actobj = state.actions.pop(0)
+        pos += 1
+        ui.progress(_("editing"), pos, actobj.torule(),
+                    _('changes'), total)
         ui.debug('histedit: processing %s %s\n' % (actobj.verb,\
                                                    actobj.torule()))
         parentctx, replacement_ = actobj.run()
         state.parentctxnode = parentctx.node()
         state.replacements.extend(replacement_)
     state.write()
+    ui.progress(_("editing"), None)
 
     hg.update(repo, state.parentctxnode, quietempty=True)
 
--- a/tests/test-histedit-fold.t	Sun Dec 20 18:38:21 2015 +0900
+++ b/tests/test-histedit-fold.t	Fri Dec 18 06:19:22 2015 +0000
@@ -234,10 +234,14 @@
   summary:     f
   
 
-  $ hg histedit e860deea161a --commands - 2>&1 <<EOF | fixbundle
+  $ hg --config progress.debug=1 --debug \
+  > histedit e860deea161a --commands - 2>&1 <<EOF | \
+  > egrep 'editing|unresolved'
   > pick e860deea161a e
   > fold a00ad806cb55 f
   > EOF
+  editing: pick e860deea161a 4 e 1/2 changes (50.00%)
+  editing: fold a00ad806cb55 5 f 2/2 changes (100.00%)
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved