|
1 Test hg log changeset printer external hook |
|
2 ------------------------------------------- |
|
3 |
|
4 $ cat > $TESTTMP/logexthook.py <<EOF |
|
5 > from mercurial import repair, commands |
|
6 > from mercurial import cmdutil |
|
7 > def rot13description(self, ctx): |
|
8 > summary = "summary".encode('rot13') |
|
9 > description = ctx.description().strip().splitlines()[0].encode('rot13') |
|
10 > self.ui.write("%s: %s\n" % (summary, description)) |
|
11 > def reposetup(ui, repo): |
|
12 > cmdutil.changeset_printer._exthook = rot13description |
|
13 > EOF |
|
14 |
|
15 Prepare the repository |
|
16 |
|
17 $ hg init empty |
|
18 $ cd empty |
|
19 $ touch ROOT |
|
20 $ hg commit -A -m "Root" ROOT |
|
21 |
|
22 $ touch a b c |
|
23 $ hg commit -A -m "Add A, B, C" a b c |
|
24 |
|
25 Check the log |
|
26 |
|
27 $ hg log --config extensions.t=$TESTTMP/logexthook.py |
|
28 changeset: 1:70fc82b23320 |
|
29 tag: tip |
|
30 user: test |
|
31 date: Thu Jan 01 00:00:00 1970 +0000 |
|
32 fhzznel: Nqq N, O, P |
|
33 summary: Add A, B, C |
|
34 |
|
35 changeset: 0:b00443a54871 |
|
36 user: test |
|
37 date: Thu Jan 01 00:00:00 1970 +0000 |
|
38 fhzznel: Ebbg |
|
39 summary: Root |
|
40 |
|
41 Check that exthook is working with graph log too |
|
42 |
|
43 $ hg log -G --config extensions.t=$TESTTMP/logexthook.py |
|
44 @ changeset: 1:70fc82b23320 |
|
45 | tag: tip |
|
46 | user: test |
|
47 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
48 | fhzznel: Nqq N, O, P |
|
49 | summary: Add A, B, C |
|
50 | |
|
51 o changeset: 0:b00443a54871 |
|
52 user: test |
|
53 date: Thu Jan 01 00:00:00 1970 +0000 |
|
54 fhzznel: Ebbg |
|
55 summary: Root |
|
56 |