# HG changeset patch # User Bryan O'Sullivan # Date 2013-05-14 18:23:18 # Node ID f184fe1e2ac5cd57f59be624a3d1576b2d11f5f7 # Parent 0250047a365e7419026dca811cd3a8f1aafd56ad summary: add a histedit hook 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