# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1537504623 14400
#      Fri Sep 21 00:37:03 2018 -0400
# Node ID 0be4328bfbaf10cbd9f8aa6e96222107426567a5
# Parent  1b0ca924a1c3de80bf3b2b3efcf0f82b2815b4d7
py3: fix a type error in hghave.has_hardlink

test-hghave.t was failing with:

      feature hardlink failed:  argument 1: <class 'TypeError'>: wrong type

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -16,6 +16,16 @@ checks = {
     "false": (lambda: False, "nail clipper"),
 }
 
+def _bytespath(p):
+    if p is None:
+        return p
+    return p.encode('utf-8')
+
+def _strpath(p):
+    if p is None:
+        return p
+    return p.decode('utf-8')
+
 def check(name, desc):
     """Registers a check function for a feature."""
     def decorator(func):
@@ -360,7 +370,7 @@ def has_hardlink():
     os.close(fh)
     name = tempfile.mktemp(dir='.', prefix=tempprefix)
     try:
-        util.oslink(fn, name)
+        util.oslink(_bytespath(fn), _bytespath(name))
         os.unlink(name)
         return True
     except OSError:
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to