py3: make tests/svn-safe-append.py compatible with python 3
Differential Revision: https://phab.mercurial-scm.org/D4671
--- a/tests/svn-safe-append.py Thu Sep 20 17:16:16 2018 +0300
+++ b/tests/svn-safe-append.py Thu Sep 20 17:17:02 2018 +0300
@@ -9,14 +9,18 @@
import stat
import sys
-text = sys.argv[1]
-fname = sys.argv[2]
+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]
f = open(fname, "ab")
try:
before = os.fstat(f.fileno())[stat.ST_MTIME]
f.write(text)
- f.write("\n")
+ f.write(b"\n")
finally:
f.close()
inc = 1