[PATCH 2 of 2] py3: fix a type error in hghave.has_hardlink
Yuya Nishihara
yuya at tcha.org
Fri Sep 21 07:22:05 EDT 2018
On Fri, 21 Sep 2018 01:03:05 -0400, Matt Harbison wrote:
> # 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')
Can you conditionalize these? On Python 2, mktemp() should return a byte
string.
> @@ -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))
More information about the Mercurial-devel
mailing list