##// END OF EJS Templates
extensions: fix up many many debug logs that use %r...
extensions: fix up many many debug logs that use %r This gets us a bunch closer on Python 3, but I'll still have to use a ton of sad globs. A previous version of this patch tried to preserve the %r formatting, but upon review Yuya noted that special characters in extension names is very unlikely, so we can just use %s and not sweat the quoting. Differential Revision: https://phab.mercurial-scm.org/D5002

File last commit:

r39693:2b9f315a default
r40467:09a37a5d default
Show More
test-log-exthook.t
61 lines | 1.6 KiB | text/troff | Tads3Lexer
/ tests / test-log-exthook.t
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 Test hg log changeset printer external hook
-------------------------------------------
$ cat > $TESTTMP/logexthook.py <<EOF
Augie Fackler
tests: update test-log-exthook to pass our import checker
r33966 > from __future__ import absolute_import
Pulkit Goyal
py3: use codecs.encode() to encode in rot-13 encoding...
r39693 > import codecs
Augie Fackler
tests: update test-log-exthook to pass our import checker
r33966 > from mercurial import (
> commands,
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 > logcmdutil,
Augie Fackler
tests: update test-log-exthook to pass our import checker
r33966 > repair,
> )
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 > def rot13description(self, ctx):
Pulkit Goyal
py3: use codecs.encode() to encode in rot-13 encoding...
r39693 > summary = codecs.encode("summary", 'rot-13')
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 > description = ctx.description().strip().splitlines()[0].encode('rot13')
> self.ui.write("%s: %s\n" % (summary, description))
> def reposetup(ui, repo):
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 > logcmdutil.changesetprinter._exthook = rot13description
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 > EOF
Prepare the repository
$ hg init empty
$ cd empty
$ touch ROOT
$ hg commit -A -m "Root" ROOT
$ touch a b c
$ hg commit -A -m "Add A, B, C" a b c
Check the log
$ hg log --config extensions.t=$TESTTMP/logexthook.py
changeset: 1:70fc82b23320
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Nqq N, O, P
summary: Add A, B, C
changeset: 0:b00443a54871
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Ebbg
summary: Root
Check that exthook is working with graph log too
$ hg log -G --config extensions.t=$TESTTMP/logexthook.py
@ changeset: 1:70fc82b23320
| tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| fhzznel: Nqq N, O, P
| summary: Add A, B, C
|
o changeset: 0:b00443a54871
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Ebbg
summary: Root