Patchwork [2,of,2,v2] histedit: add progress support

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 18, 2015, 6:23 a.m.
Message ID <8cf12d5ffc8fdec60884.1450419806@waste.org>
Download mbox | patch
Permalink /patch/12142/
State Accepted
Commit f209c85183a72873a9428e2f68b617e56bd09d7f
Delegated to: Augie Fackler
Headers show

Comments

timeless@mozdev.org - Dec. 18, 2015, 6:23 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450419562 0
#      Fri Dec 18 06:19:22 2015 +0000
# Node ID 8cf12d5ffc8fdec608849ba3eacdd66f66fe5621
# Parent  56d2e69bf248235298c2071af6faadf615045890
histedit: add progress support
Matt Mackall - Dec. 20, 2015, 10:41 p.m.
On Fri, 2015-12-18 at 00:23 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1450419562 0
> #      Fri Dec 18 06:19:22 2015 +0000
> # Node ID 8cf12d5ffc8fdec608849ba3eacdd66f66fe5621
> # Parent  56d2e69bf248235298c2071af6faadf615045890
> histedit: add progress support

I've taken just this second patch for now, with s/editing/editting/,
thanks.
-- 
Mathematics is the supreme nostalgia of our time.

Patch

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