[PATCH 3 of 3] histedit: add progress support

timeless timeless at mozdev.org
Fri Dec 18 00:21:39 CST 2015


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1450419562 0
#      Fri Dec 18 06:19:22 2015 +0000
# Node ID 4971b393e0393b37ac5cf2f53e2843816185ac7d
# Parent  e314b1e41a4cb21ecc66fd19153bf6aec77a2143
histedit: add progress support

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1071,15 +1071,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(_("editting"), 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(_("editting"), None)
 
     hg.update(repo, state.parentctxnode, show_stats=False)
 
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -231,10 +231,14 @@
   summary:     f
   
 
-  $ hg histedit e860deea161a --commands - 2>&1 <<EOF | fixbundle
+  $ hg --config progress.debug=1 --debug \
+  > histedit e860deea161a --commands - 2>&1 <<EOF | \
+  > egrep 'editting|unresolved'
   > pick e860deea161a e
   > fold a00ad806cb55 f
   > EOF
+  editting: pick e860deea161a 4 e 1/2 changes (50.00%)
+  editting: fold a00ad806cb55 5 f 2/2 changes (100.00%)
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 


More information about the Mercurial-devel mailing list