py3: byteify test-lfs.t
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 01 Oct 2018 23:07:19 -0400
changeset 39950 8d41097dfe7d
parent 39949 e1f97179a3f5
child 39951 a339b5e0d7c6
py3: byteify test-lfs.t
tests/test-lfs.t
--- a/tests/test-lfs.t	Mon Oct 01 23:04:58 2018 -0400
+++ b/tests/test-lfs.t	Mon Oct 01 23:07:19 2018 -0400
@@ -549,9 +549,13 @@
    4 files changed, 2 insertions(+), 0 deletions(-)
   $ hg commit -m binarytest
   $ cat > $TESTTMP/dumpbinary.py << EOF
+  > from mercurial.utils import (
+  >     stringutil,
+  > )
   > def reposetup(ui, repo):
-  >     for n in 'abcd':
-  >         ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary()))
+  >     for n in (b'a', b'b', b'c', b'd'):
+  >         ui.write((b'%s: binary=%s\n')
+  >                   % (n, stringutil.pprint(repo[b'.'][n].isbinary())))
   > EOF
   $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace
   a: binary=True
@@ -679,14 +683,20 @@
   > # print raw revision sizes, flags, and hashes for certain files
   > import hashlib
   > from mercurial.node import short
-  > from mercurial import revlog
+  > from mercurial import (
+  >     pycompat,
+  >     revlog,
+  > )
+  > from mercurial.utils import (
+  >     stringutil,
+  > )
   > def hash(rawtext):
   >     h = hashlib.sha512()
   >     h.update(rawtext)
-  >     return h.hexdigest()[:4]
+  >     return pycompat.sysbytes(h.hexdigest()[:4])
   > def reposetup(ui, repo):
   >     # these 2 files are interesting
-  >     for name in ['l', 's']:
+  >     for name in [b'l', b's']:
   >         fl = repo.file(name)
   >         if len(fl) == 0:
   >             continue
@@ -694,8 +704,8 @@
   >         texts = [fl.revision(i, raw=True) for i in fl]
   >         flags = [int(fl._revlog.flags(i)) for i in fl]
   >         hashes = [hash(t) for t in texts]
-  >         print('  %s: rawsizes=%r flags=%r hashes=%r'
-  >               % (name, sizes, flags, hashes))
+  >         pycompat.stdout.write(b'  %s: rawsizes=%r flags=%r hashes=%s\n'
+  >                               % (name, sizes, flags, stringutil.pprint(hashes)))
   > EOF
 
   $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \