##// END OF EJS Templates
global: use python3 in shebangs...
global: use python3 in shebangs Python 3 is the future. We want Python scripts to be using Python 3 by default. This change updates all `#!/usr/bin/env python` shebangs to use `python3`. Does this mean all scripts use or require Python 3: no. In the test environment, the `PATH` environment variable in tests is updated to guarantee that the Python executable used to run run-tests.py is used. Since test scripts all now use `#!/usr/bin/env python3`, we had to update this code to install a `python3` symlink instead of `python`. It is possible there are some random scripts now executed with the incorrect Python interpreter in some contexts. However, I would argue that this was a pre-existing bug: we should almost always be executing new Python processes using the `sys.executable` from the originating Python script, as `python` or `python3` won't guarantee we'll use the same interpreter. Differential Revision: https://phab.mercurial-scm.org/D9273

File last commit:

r46434:c102b704 default
r46434:c102b704 default
Show More
svn-safe-append.py
32 lines | 680 B | text/x-python | PythonLexer
/ tests / svn-safe-append.py
Gregory Szorc
global: use python3 in shebangs...
r46434 #!/usr/bin/env python3
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 from __future__ import absolute_import
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 __doc__ = """Same as `echo a >> b`, but ensures a changed mtime of b.
Without this svn will not detect workspace changes."""
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 import os
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 import stat
Pulkit Goyal
py3: make tests/svn-safe-append.py use absolute_import
r29195 import sys
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439
Pulkit Goyal
py3: make tests/svn-safe-append.py compatible with python 3...
r39760 if sys.version_info[0] >= 3:
text = os.fsencode(sys.argv[1])
fname = os.fsencode(sys.argv[2])
else:
text = sys.argv[1]
fname = sys.argv[2]
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439
f = open(fname, "ab")
try:
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 before = os.fstat(f.fileno())[stat.ST_MTIME]
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 f.write(text)
Pulkit Goyal
py3: make tests/svn-safe-append.py compatible with python 3...
r39760 f.write(b"\n")
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 finally:
f.close()
inc = 1
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 now = os.stat(fname)[stat.ST_MTIME]
Peter Arrenbrecht
convert: fix test-convert-svn-* problems with mtime not changing...
r6439 while now == before:
t = now + inc
inc += 1
os.utime(fname, (t, t))
Augie Fackler
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime...
r36799 now = os.stat(fname)[stat.ST_MTIME]