Mercurial > hg-stable
changeset 9711:d29bd00bbc50
color: wrap qrecord
The qrecord command is registered in uisetup phase, so we do our
wrapping in extsetup phase.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Thu, 05 Nov 2009 01:11:28 +0100 |
parents | 1765599f4899 |
children | 18b134ef294c |
files | hgext/color.py tests/test-diff-color tests/test-diff-color.out |
diffstat | 3 files changed, 34 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Thu Nov 05 01:10:43 2009 +0100 +++ b/hgext/color.py Thu Nov 05 01:11:28 2009 +0100 @@ -235,7 +235,7 @@ 'changed': ['white'], 'trailingwhitespace': ['bold', 'red_background']} -def uisetup(ui): +def extsetup(ui): '''Initialize the extension.''' _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) @@ -249,15 +249,17 @@ _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) except KeyError: - # The mq extension is not enabled - pass + mq = None try: rec = extensions.find('record') _setupcmd(ui, 'record', rec.cmdtable, colordiff, _diff_effects) except KeyError: - # The record extension is not enabled - pass + rec = None + + if mq and rec: + _setupcmd(ui, 'qrecord', rec.cmdtable, colordiff, _diff_effects) + def _setupcmd(ui, cmd, table, func, effectsmap): '''patch in command to command table and load effect map'''
--- a/tests/test-diff-color Thu Nov 05 01:10:43 2009 +0100 +++ b/tests/test-diff-color Thu Nov 05 01:11:28 2009 +0100 @@ -51,3 +51,14 @@ y EOF echo + +echo "[extensions]" >> $HGRCPATH +echo "mq=" >> $HGRCPATH + +hg rollback +echo % qrecord +hg qrecord --color=always -m moda patch <<EOF +y +y +EOF +echo
--- a/tests/test-diff-color.out Thu Nov 05 01:10:43 2009 +0100 +++ b/tests/test-diff-color.out Thu Nov 05 01:11:28 2009 +0100 @@ -41,3 +41,19 @@ a c record this change to 'a'? [Ynsfdaq?] +rolling back last transaction +% qrecord +[0;1mdiff --git a/a b/a[0m +[0;36;1mold mode 100644[0m +[0;36;1mnew mode 100755[0m +1 hunks, 2 lines changed +examine changes to 'a'? [Ynsfdaq?] [0;35m@@ -2,7 +2,7 @@[0m + c + a + a +[0;31m-b[0m +[0;32m+dd[0m + a + a + c +record this change to 'a'? [Ynsfdaq?]