D5061: f: fix a Python 3 bytes/string issue

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sat Oct 13 10:06:31 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I suspect we should test this tool in isolation, but we don't yet. Oh well.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5061

AFFECTED FILES
  tests/f

CHANGE DETAILS

diff --git a/tests/f b/tests/f
--- a/tests/f
+++ b/tests/f
@@ -88,9 +88,11 @@
             if opts.newer:
                 # mtime might be in whole seconds so newer file might be same
                 if stat.st_mtime >= os.stat(opts.newer).st_mtime:
-                    facts.append(b'newer than %s' % opts.newer)
+                    facts.append(b'newer than %s' % opts.newer.encode(
+                        'utf8', 'replace'))
                 else:
-                    facts.append(b'older than %s' % opts.newer)
+                    facts.append(b'older than %s' % opts.newer.encode(
+                        'utf8', 'replace'))
         if opts.md5 and content is not None:
             h = hashlib.md5(content)
             facts.append(b'md5=%s' % binascii.hexlify(h.digest())[:opts.bytes])



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list