sapling/eden/scm/tests/test-log-exthook.t
Zeyi (Rice) Fan 92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00

62 lines
1.5 KiB
Perl

#require py2
#chg-compatible
Test hg log changeset printer external hook
-------------------------------------------
$ cat > $TESTTMP/logexthook.py <<EOF
> from __future__ import absolute_import
> from edenscm.mercurial import (
> cmdutil,
> commands,
> repair,
> )
> def rot13description(self, ctx):
> summary = "summary".encode('rot13')
> description = ctx.description().strip().splitlines()[0].encode('rot13')
> self.ui.write("%s: %s\n" % (summary, description))
> def reposetup(ui, repo):
> cmdutil.changeset_printer._exthook = rot13description
> 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
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
| 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