2016-10-09 14:59:20 +03:00
|
|
|
#require py3exe
|
|
|
|
|
|
|
|
This test helps in keeping a track on which commands we can run on
|
|
|
|
Python 3 and see what kind of errors are coming up.
|
|
|
|
The full traceback is hidden to have a stable output.
|
2017-03-12 10:37:45 +03:00
|
|
|
$ HGBIN=`which hg`
|
2016-10-09 14:59:20 +03:00
|
|
|
|
|
|
|
$ for cmd in version debuginstall ; do
|
|
|
|
> echo $cmd
|
2017-03-12 10:37:45 +03:00
|
|
|
> $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
|
2016-10-09 14:59:20 +03:00
|
|
|
> done
|
|
|
|
version
|
2016-12-13 18:23:40 +03:00
|
|
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2016-10-09 14:59:20 +03:00
|
|
|
debuginstall
|
2017-03-09 02:11:41 +03:00
|
|
|
no problems detected
|
2017-03-03 21:52:08 +03:00
|
|
|
|
2017-03-12 10:33:38 +03:00
|
|
|
#if test-repo
|
|
|
|
Make a clone so that any features in the developer's .hg/hgrc that
|
|
|
|
might confuse Python 3 don't break this test. When we can do commit in
|
|
|
|
Python 3, we'll stop doing this. We use e76ed1e480ef for the clone
|
|
|
|
because it has different files than 273ce12ad8f1, so we can test both
|
|
|
|
`files` from dirstate and `files` loaded from a specific revision.
|
|
|
|
|
|
|
|
$ hg clone -r e76ed1e480ef "`dirname "$TESTDIR"`" testrepo 2>&1 | tail -1
|
|
|
|
15 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
Test using -R, which exercises some URL code:
|
|
|
|
$ $PYTHON3 $HGBIN -R testrepo files -r 273ce12ad8f1 | tail -1
|
|
|
|
testrepo/tkmerge
|
|
|
|
|
|
|
|
Now prove `hg files` is reading the whole manifest. We have to grep
|
|
|
|
out some potential warnings that come from hgrc as yet.
|
|
|
|
$ cd testrepo
|
|
|
|
$ $PYTHON3 $HGBIN files -r 273ce12ad8f1
|
|
|
|
.hgignore
|
|
|
|
PKG-INFO
|
|
|
|
README
|
|
|
|
hg
|
|
|
|
mercurial/__init__.py
|
|
|
|
mercurial/byterange.py
|
|
|
|
mercurial/fancyopts.py
|
|
|
|
mercurial/hg.py
|
|
|
|
mercurial/mdiff.py
|
|
|
|
mercurial/revlog.py
|
|
|
|
mercurial/transaction.py
|
|
|
|
notes.txt
|
|
|
|
setup.py
|
|
|
|
tkmerge
|
|
|
|
|
|
|
|
$ $PYTHON3 $HGBIN files -r 273ce12ad8f1 | wc -l
|
|
|
|
\s*14 (re)
|
|
|
|
$ $PYTHON3 $HGBIN files | wc -l
|
|
|
|
\s*15 (re)
|
2017-03-13 19:24:53 +03:00
|
|
|
|
2017-03-14 12:23:59 +03:00
|
|
|
Test if log-like commands work:
|
2017-03-13 19:24:53 +03:00
|
|
|
|
|
|
|
$ $PYTHON3 $HGBIN tip
|
|
|
|
changeset: 10:e76ed1e480ef
|
|
|
|
tag: tip
|
|
|
|
user: oxymoron@cinder.waste.org
|
|
|
|
date: Tue May 03 23:37:43 2005 -0800
|
|
|
|
summary: Fix linking of changeset revs when merging
|
|
|
|
|
|
|
|
|
2017-03-14 12:23:59 +03:00
|
|
|
$ $PYTHON3 $HGBIN log -r0
|
|
|
|
changeset: 0:9117c6561b0b
|
|
|
|
user: mpm@selenic.com
|
|
|
|
date: Tue May 03 13:16:10 2005 -0800
|
|
|
|
summary: Add back links from file revisions to changeset revisions
|
|
|
|
|
|
|
|
|
2017-03-12 10:33:38 +03:00
|
|
|
$ cd ..
|
|
|
|
#endif
|
|
|
|
|
2017-03-21 00:45:18 +03:00
|
|
|
Test if `hg config` works:
|
|
|
|
|
|
|
|
$ $PYTHON3 $HGBIN config
|
|
|
|
devel.all-warnings=true
|
2017-05-29 00:02:24 +03:00
|
|
|
devel.default-date=0 0
|
2017-03-21 00:45:18 +03:00
|
|
|
largefiles.usercache=$TESTTMP/.cache/largefiles
|
|
|
|
ui.slash=True
|
|
|
|
ui.interactive=False
|
|
|
|
ui.mergemarkers=detailed
|
|
|
|
ui.promptecho=True
|
|
|
|
web.address=localhost
|
|
|
|
web.ipv6=False
|
|
|
|
|
2017-03-03 21:52:08 +03:00
|
|
|
$ cat > included-hgrc <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> babar = imaginary_elephant
|
|
|
|
> EOF
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> %include $TESTTMP/included-hgrc
|
|
|
|
> EOF
|
2017-03-12 10:37:45 +03:00
|
|
|
$ $PYTHON3 $HGBIN version | tail -1
|
2017-03-03 21:52:08 +03:00
|
|
|
*** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
|
|
|
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
py3: add "b" prefix to string literals related to module policy
String literals without explicit prefix in __init__.py and policy.py
are treated as unicode object on Python3, because these modules are
loaded before setup of our specific code transformation (the later
module is imported at the beginning of __init__.py).
BTW, "modulepolicy" in __init__.py is initialized by "policy.policy".
This causes issues below;
- checking "policy" value in other modules causes unintentional result
For example, "b'py' not in (u'c', u'py')" returns True
unintentionally on Python3.
- writing "policy" out fails at conversion from unicode to bytes
db1ebf457295 fixed this issue for default code path, but "policy"
can be overridden by HGMODULEPOLICY environment variable (it should
be rare case for developer using Python3, though).
This patch does:
- add "b" prefix to all string literals, which are related to module
policy, in modules above.
- check existence of HGMODULEPOLICY, and overwrite "policy" only if
it exists
For simplicity, this patch omits checking "supports_bytes_environ",
switching os.environ/os.environb, and so on (Yuya agreed this in
personal talking)
2017-03-12 22:06:36 +03:00
|
|
|
|
2017-03-13 23:08:11 +03:00
|
|
|
$ rm included-hgrc
|
|
|
|
$ touch included-hgrc
|
|
|
|
|
py3: add "b" prefix to string literals related to module policy
String literals without explicit prefix in __init__.py and policy.py
are treated as unicode object on Python3, because these modules are
loaded before setup of our specific code transformation (the later
module is imported at the beginning of __init__.py).
BTW, "modulepolicy" in __init__.py is initialized by "policy.policy".
This causes issues below;
- checking "policy" value in other modules causes unintentional result
For example, "b'py' not in (u'c', u'py')" returns True
unintentionally on Python3.
- writing "policy" out fails at conversion from unicode to bytes
db1ebf457295 fixed this issue for default code path, but "policy"
can be overridden by HGMODULEPOLICY environment variable (it should
be rare case for developer using Python3, though).
This patch does:
- add "b" prefix to all string literals, which are related to module
policy, in modules above.
- check existence of HGMODULEPOLICY, and overwrite "policy" only if
it exists
For simplicity, this patch omits checking "supports_bytes_environ",
switching os.environ/os.environb, and so on (Yuya agreed this in
personal talking)
2017-03-12 22:06:36 +03:00
|
|
|
Test bytes-ness of policy.policy with HGMODULEPOLICY
|
|
|
|
|
|
|
|
$ HGMODULEPOLICY=py
|
|
|
|
$ export HGMODULEPOLICY
|
|
|
|
$ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1
|
|
|
|
no problems detected
|
2017-03-13 23:06:37 +03:00
|
|
|
|
|
|
|
`hg init` can create empty repos
|
2017-03-26 18:40:25 +03:00
|
|
|
`hg status works fine`
|
2017-03-29 12:26:58 +03:00
|
|
|
`hg summary` also works!
|
2017-03-13 23:06:37 +03:00
|
|
|
|
2017-03-19 08:47:56 +03:00
|
|
|
$ $PYTHON3 `which hg` init py3repo
|
|
|
|
$ cd py3repo
|
|
|
|
$ echo "This is the file 'iota'." > iota
|
|
|
|
$ $PYTHON3 $HGBIN status
|
|
|
|
? iota
|
|
|
|
$ $PYTHON3 $HGBIN add iota
|
|
|
|
$ $PYTHON3 $HGBIN status
|
|
|
|
A iota
|
|
|
|
$ $PYTHON3 $HGBIN commit --message 'commit performed in Python 3'
|
|
|
|
$ $PYTHON3 $HGBIN status
|
|
|
|
|
|
|
|
$ mkdir A
|
|
|
|
$ echo "This is the file 'mu'." > A/mu
|
|
|
|
$ $PYTHON3 $HGBIN addremove
|
|
|
|
adding A/mu
|
|
|
|
$ $PYTHON3 $HGBIN status
|
|
|
|
A A/mu
|
|
|
|
$ HGEDITOR='echo message > ' $PYTHON3 $HGBIN commit
|
|
|
|
$ $PYTHON3 $HGBIN status
|
2017-03-29 12:26:58 +03:00
|
|
|
$ $PYHON3 $HGBIN summary
|
|
|
|
parent: 1:e1e9167203d4 tip
|
|
|
|
message
|
|
|
|
branch: default
|
|
|
|
commit: (clean)
|
|
|
|
update: (current)
|
|
|
|
phases: 2 draft
|
2017-03-19 08:47:56 +03:00
|
|
|
|
|
|
|
Prove the repo is valid using the Python 2 `hg`:
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
2017-03-26 13:11:41 +03:00
|
|
|
2 files, 2 changesets, 2 total revisions
|
2017-03-19 08:47:56 +03:00
|
|
|
$ hg log
|
2017-03-26 13:11:41 +03:00
|
|
|
changeset: 1:e1e9167203d4
|
2017-03-19 08:47:56 +03:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: message
|
|
|
|
|
2017-03-26 13:11:41 +03:00
|
|
|
changeset: 0:71c96e924262
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: commit performed in Python 3
|
|
|
|
|
2017-05-04 02:22:03 +03:00
|
|
|
|
|
|
|
$ hg log -G
|
|
|
|
@ changeset: 1:e1e9167203d4
|
|
|
|
| tag: tip
|
|
|
|
| user: test
|
|
|
|
| date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
| summary: message
|
|
|
|
|
|
|
|
|
o changeset: 0:71c96e924262
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: commit performed in Python 3
|
|
|
|
|
2017-05-04 02:27:30 +03:00
|
|
|
$ hg log -Tjson
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"rev": 1,
|
|
|
|
"node": "e1e9167203d450ca2f558af628955b5f5afd4489",
|
|
|
|
"branch": "default",
|
|
|
|
"phase": "draft",
|
|
|
|
"user": "test",
|
|
|
|
"date": [0, 0],
|
|
|
|
"desc": "message",
|
|
|
|
"bookmarks": [],
|
|
|
|
"tags": ["tip"],
|
|
|
|
"parents": ["71c96e924262969ff0d8d3d695b0f75412ccc3d8"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"rev": 0,
|
|
|
|
"node": "71c96e924262969ff0d8d3d695b0f75412ccc3d8",
|
|
|
|
"branch": "default",
|
|
|
|
"phase": "draft",
|
|
|
|
"user": "test",
|
|
|
|
"date": [0, 0],
|
|
|
|
"desc": "commit performed in Python 3",
|
|
|
|
"bookmarks": [],
|
|
|
|
"tags": [],
|
|
|
|
"parents": ["0000000000000000000000000000000000000000"]
|
|
|
|
}
|
|
|
|
]
|