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