Mercurial > hg-stable
annotate tests/test-log-exthook.t @ 48938:4561ec90d3c1
automation: delete code related to Python 2.7 support
The building of Inno and WiX installers took a python_version argument
that allowed us to specify "2" or "3" for the major Python version. Since
we no longer support Python 2, we can delete this argument and everything
feeding into it.
Differential Revision: https://phab.mercurial-scm.org/D12264
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 19 Feb 2022 18:42:12 -0700 |
parents | 005bc856e919 |
children | 42d2b31cee0b |
rev | line source |
---|---|
33160
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
1 Test hg log changeset printer external hook |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 ------------------------------------------- |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 $ cat > $TESTTMP/logexthook.py <<EOF |
33982
bfafd189edd9
tests: update test-log-exthook to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33160
diff
changeset
|
5 > from __future__ import absolute_import |
39673
2b9f315a4217
py3: use codecs.encode() to encode in rot-13 encoding
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
35928
diff
changeset
|
6 > import codecs |
33982
bfafd189edd9
tests: update test-log-exthook to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33160
diff
changeset
|
7 > from mercurial import ( |
bfafd189edd9
tests: update test-log-exthook to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33160
diff
changeset
|
8 > commands, |
35928
c8e2d6ed1f9e
cmdutil: drop aliases for logcmdutil functions (API)
Yuya Nishihara <yuya@tcha.org>
parents:
33982
diff
changeset
|
9 > logcmdutil, |
33982
bfafd189edd9
tests: update test-log-exthook to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33160
diff
changeset
|
10 > repair, |
bfafd189edd9
tests: update test-log-exthook to pass our import checker
Augie Fackler <raf@durin42.com>
parents:
33160
diff
changeset
|
11 > ) |
40506
005bc856e919
py3: port test-log-exthook.t to Python 3
Augie Fackler <augie@google.com>
parents:
39673
diff
changeset
|
12 > def brot13(b): |
005bc856e919
py3: port test-log-exthook.t to Python 3
Augie Fackler <augie@google.com>
parents:
39673
diff
changeset
|
13 > return codecs.encode(b.decode('utf8'), 'rot-13').encode('utf8') |
33160
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
14 > def rot13description(self, ctx): |
40506
005bc856e919
py3: port test-log-exthook.t to Python 3
Augie Fackler <augie@google.com>
parents:
39673
diff
changeset
|
15 > description = ctx.description().strip().splitlines()[0] |
005bc856e919
py3: port test-log-exthook.t to Python 3
Augie Fackler <augie@google.com>
parents:
39673
diff
changeset
|
16 > self.ui.write(b"%s: %s\n" % (brot13(b"summary"), |
005bc856e919
py3: port test-log-exthook.t to Python 3
Augie Fackler <augie@google.com>
parents:
39673
diff
changeset
|
17 > brot13(description))) |
33160
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 > def reposetup(ui, repo): |
35928
c8e2d6ed1f9e
cmdutil: drop aliases for logcmdutil functions (API)
Yuya Nishihara <yuya@tcha.org>
parents:
33982
diff
changeset
|
19 > logcmdutil.changesetprinter._exthook = rot13description |
33160
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 > EOF |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 Prepare the repository |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
23 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
24 $ hg init empty |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
25 $ cd empty |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
26 $ touch ROOT |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
27 $ hg commit -A -m "Root" ROOT |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
28 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
29 $ touch a b c |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
30 $ hg commit -A -m "Add A, B, C" a b c |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
31 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
32 Check the log |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
33 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
34 $ hg log --config extensions.t=$TESTTMP/logexthook.py |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
35 changeset: 1:70fc82b23320 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
36 tag: tip |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
37 user: test |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
38 date: Thu Jan 01 00:00:00 1970 +0000 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
39 fhzznel: Nqq N, O, P |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
40 summary: Add A, B, C |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
42 changeset: 0:b00443a54871 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
43 user: test |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 date: Thu Jan 01 00:00:00 1970 +0000 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
45 fhzznel: Ebbg |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
46 summary: Root |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
47 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
48 Check that exthook is working with graph log too |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
49 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
50 $ hg log -G --config extensions.t=$TESTTMP/logexthook.py |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
51 @ changeset: 1:70fc82b23320 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
52 | tag: tip |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
53 | user: test |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
54 | date: Thu Jan 01 00:00:00 1970 +0000 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
55 | fhzznel: Nqq N, O, P |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
56 | summary: Add A, B, C |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
57 | |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
58 o changeset: 0:b00443a54871 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
59 user: test |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
60 date: Thu Jan 01 00:00:00 1970 +0000 |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
61 fhzznel: Ebbg |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
62 summary: Root |
4ecc6047d45f
log: add an extension hook-point in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
63 |