[PATCH 2 of 2] py3: fix a type error in hghave.has_hardlink
Matt Harbison
mharbison72 at gmail.com
Fri Sep 21 05:03:05 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at 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:
More information about the Mercurial-devel
mailing list