Patchwork [5,of,5] summary: add a histedit hook

login
register
mail settings
Submitter Bryan O'Sullivan
Date May 14, 2013, 6:24 p.m.
Message ID <e6cbe99f193f58a4d505.1368555871@australite.thefacebook.com>
Download mbox | patch
Permalink /patch/1638/
State Accepted
Commit f184fe1e2ac5cd57f59be624a3d1576b2d11f5f7
Headers show

Comments

Bryan O'Sullivan - May 14, 2013, 6:24 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1368555798 25200
#      Tue May 14 11:23:18 2013 -0700
# Node ID e6cbe99f193f58a4d5052c3e732d38a7f64270b7
# Parent  00bf6cf86e28c01b1201bb2255003ebf043f84f0
summary: add a histedit hook
Matt Mackall - May 17, 2013, 7:35 p.m.
On Tue, 2013-05-14 at 11:24 -0700, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano@fb.com>
> # Date 1368555798 25200
> #      Tue May 14 11:23:18 2013 -0700
> # Node ID e6cbe99f193f58a4d5052c3e732d38a7f64270b7
> # Parent  00bf6cf86e28c01b1201bb2255003ebf043f84f0
> summary: add a histedit hook

These are queued for default, thanks.

Patch

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -63,6 +63,8 @@  Default effects may be overridden from y
   rebase.rebased = blue
   rebase.remaining = red bold
 
+  histedit.remaining = red bold
+
 The available effects in terminfo mode are 'blink', 'bold', 'dim',
 'inverse', 'invisible', 'italic', 'standout', and 'underline'; in
 ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and
@@ -251,6 +253,7 @@  except ImportError:
            'diff.trailingwhitespace': 'bold red_background',
            'diffstat.deleted': 'red',
            'diffstat.inserted': 'green',
+           'histedit.remaining': 'red bold',
            'ui.prompt': 'yellow',
            'log.changeset': 'yellow',
            'rebase.rebased': 'blue',
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -856,3 +856,16 @@  def cleanupnode(ui, repo, name, nodes):
             repair.strip(ui, repo, c)
     finally:
         lockmod.release(lock)
+
+def summaryhook(ui, repo):
+    if not os.path.exists(repo.join('histedit-state')):
+        return
+    (parentctxnode, rules, keep, topmost, replacements) = readstate(repo)
+    if rules:
+        # i18n: column positioning for "hg summary"
+        ui.write(_('hist:   %s (histedit --continue)\n') %
+                 (ui.label(_('%d remaining'), 'histedit.remaining') %
+                  len(rules)))
+
+def extsetup(ui):
+    cmdutil.summaryhooks.add('histedit', summaryhook)
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -159,6 +159,7 @@  check histedit_source
   branch: default
   commit: 1 added (new branch head)
   update: 1 new changesets (update)
+  hist:   1 remaining (histedit --continue)
 
   $ HGEDITOR='true' hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved