Mercurial > hg-stable
changeset 10825:781689b9b6bb
record: make use of output labeling
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Fri, 02 Apr 2010 15:22:15 -0500 |
parents | 18def0d5692d |
children | 717c35d55fb3 |
files | hgext/record.py |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/record.py Fri Apr 02 15:22:14 2010 -0500 +++ b/hgext/record.py Fri Apr 02 15:22:15 2010 -0500 @@ -520,7 +520,18 @@ os.rmdir(backupdir) except OSError: pass - return cmdutil.commit(ui, repo, recordfunc, pats, opts) + + # wrap ui.write so diff output can be labeled/colorized + def wrapwrite(orig, *args, **kw): + label = kw.pop('label', '') + for chunk, l in patch.difflabel(lambda: args): + orig(chunk, label=label + l) + oldwrite = ui.write + extensions.wrapfunction(ui, 'write', wrapwrite) + try: + return cmdutil.commit(ui, repo, recordfunc, pats, opts) + finally: + ui.write = oldwrite cmdtable = { "record":