##// END OF EJS Templates
py3: fix a type error in hghave.has_hardlink...
Matt Harbison -
r39795:aeb2812f default
parent child Browse files
Show More
@@ -16,6 +16,22 checks = {
16 "false": (lambda: False, "nail clipper"),
16 "false": (lambda: False, "nail clipper"),
17 }
17 }
18
18
19 if sys.version_info[0] >= 3:
20 def _bytespath(p):
21 if p is None:
22 return p
23 return p.encode('utf-8')
24
25 def _strpath(p):
26 if p is None:
27 return p
28 return p.decode('utf-8')
29 else:
30 def _bytespath(p):
31 return p
32
33 _strpath = _bytespath
34
19 def check(name, desc):
35 def check(name, desc):
20 """Registers a check function for a feature."""
36 """Registers a check function for a feature."""
21 def decorator(func):
37 def decorator(func):
@@ -360,7 +376,7 def has_hardlink():
360 os.close(fh)
376 os.close(fh)
361 name = tempfile.mktemp(dir='.', prefix=tempprefix)
377 name = tempfile.mktemp(dir='.', prefix=tempprefix)
362 try:
378 try:
363 util.oslink(fn, name)
379 util.oslink(_bytespath(fn), _bytespath(name))
364 os.unlink(name)
380 os.unlink(name)
365 return True
381 return True
366 except OSError:
382 except OSError:
General Comments 0
You need to be logged in to leave comments. Login now