diff --git a/.hgsigs b/.hgsigs --- a/.hgsigs +++ b/.hgsigs @@ -249,3 +249,4 @@ 271a4ab29605ffa0bae5d3208eaa21a95427ff92 bb42988c7e156931b0ff1e93732b98173ebbcb7f 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmSUPXUZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVvYTC/wP7f8RITHgCO8djHUsnRs60P2mlEJQ71TDA3dqgdBIr3tWMELfcZMZnOTtaw4eqKemLauxa69MHgj2y++VMnfJx1pW5G61G8ZFfLjwFvAqqmXnnT6RVjo7sPuKSkL28C9NWwrLIRk5SGWK52W56Slz0bW1yhJBOV8BEIgZM5ucs4froYTxgAP8xprbLyPIroAJEtPNU3mkOXuPPGQ/zGO9czJ9sfYHU3bPmskf3YLqWAKQdCmxQgv44QluRVWoek6caIUA04mJwwlBdCCPZnr8hvaptZeYv2hhPw7CzDfWwMkyBYzmoUAZIgu/eYPtDRtxeIlEYC2WP+DQy5R+kK+X/nfxe8kVL9USow5MZZ54tmPbrwUO/dkWOWiK5NyqYnFjBDaq24XKUoPC7p7mGkfzQPNCiKcQO3qcUtiIb7tzz0olWemD2z86ws8kaEK8GSOgpBK71KOzrPZt8B01Nb+seahftCN5HxALAJSM6VRxYJFgYMFFxid+zNwEstuNipo= 3ffc7209bbae5804a53084c9dc2d41139e88c867 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmSmyeIZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVn/CC/9l24Feazay+kN3rOCvRqOOQO0Xx47+Lx5xaC4mgSAs7fkefY0ru4gnKRQkYskIksUzJX0P6aGrS3RH3y+DzxPhha75Ufq1abD8c1NJ2mUzW/DnoEI9zKnprkUdet8cwwLzNDhuWqjG6DY1ETwWpYVHo01Yv5FjDOdbMfPJ92yyF2AxLNTjkHNNfn0dpJE+/Sz8WjKsjP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RChHgHNDgXZVjR5C/9FevkRGXbDJJjg1z9wrgb9P0IAHdYOPNvUoM8S6iYgFXbBrexkM9wzlnmlO/im+iDpizKuwVCrYPCImjtI6ukF+f+WhETpAJ7qWsrng6ZwuOfdXfc5AtE9yii3z1EtpD4lFAuD1JrNS6AZkNp60VnMj4Bn/raD0Fkjnf8W1ztV53DueEShmbVfLFVoGsoxTSc3rB+HQda1UEPpwQB2QuqND7SpK4LFGXGPDFk3huP04lfhsCqKf1+DDRA0msj9CadJ5kaPPdwLrtmu5nHrqN+MXOh5Nn2NiNLUa7K6PNzA0bdZQv8G+rFKhyQsvYJjYRtOVFEyVTosRV0kv6wXDD0k74fR8SvbjHLVKT3nSXdaa/zLQPjheKTLfo2DQW9inpKaKT6IU/9pqLjLjH1Jf29yZkapiIO5OrDwP+Icm9ciCaOwmdqZYkyPky3pdt93WNbbiQxDG95HTJwLPNDu3foecNUW7RFBj2Ri2ogxBNocwTetFf9GHVvuaXyzBEJ+zjg= diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -265,3 +265,4 @@ 271a4ab29605ffa0bae5d3208eaa21a95427ff92 bb42988c7e156931b0ff1e93732b98173ebbcb7f 6.5rc0 3ffc7209bbae5804a53084c9dc2d41139e88c867 6.5 787af4e0e8b787e1b77a8059926b123730a4cd01 6.5.1 +5a8b5420103937fca97c584c5162178eed828ada 6.5.2 diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -16,6 +16,7 @@ import os from .i18n import _ from . import ( + encoding, error, pycompat, util, @@ -229,7 +230,7 @@ class transaction(util.transactional): validator=None, releasefn=None, checkambigfiles=None, - name='', + name=b'', ): """Begin a new transaction @@ -318,7 +319,7 @@ class transaction(util.transactional): def __repr__(self): name = b'/'.join(self._names) return '' % ( - name, + encoding.strfromlocal(name), self._count, self._usages, ) @@ -574,7 +575,7 @@ class transaction(util.transactional): self._file.flush() @active - def nest(self, name=''): + def nest(self, name=b''): self._count += 1 self._usages += 1 self._names.append(name) diff --git a/relnotes/6.5 b/relnotes/6.5 --- a/relnotes/6.5 +++ b/relnotes/6.5 @@ -1,3 +1,13 @@ += Mercurial 6.5.2 = + + * hgweb: encode WSGI environment using the ISO-8859-1 codec + * rhg: fix the bug where sparse config is interpreted as relglob instead of glob + * gpg: fix an UnboundLocalError whenever using --force + * transaction: fix __repr__() and make the default name bytes + * setup: make the error "Unable to find a working hg binary" more informative + * tests: avoid test environment affecting setup.py + * run-tests: detect HGWITHRUSTEXT value + = Mercurial 6.5.1 = * A bunch of improvements to Python 3.12 compatibility diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -278,28 +278,44 @@ def findhg(): # gives precedence to hg.exe in the current directory, so fall back to the # python invocation of local hg, where pythonXY.dll can always be found. check_cmd = ['log', '-r.', '-Ttest'] - if os.name != 'nt' or not os.path.exists("hg.exe"): + attempts = [] + + def attempt(cmd, env): try: retcode, out, err = runcmd(hgcmd + check_cmd, hgenv) - except EnvironmentError: - retcode = -1 - if retcode == 0 and not filterhgerr(err): + res = (True, retcode, out, err) + if retcode == 0 and not filterhgerr(err): + return True + except EnvironmentError as e: + res = (False, e) + attempts.append((cmd, res)) + return False + + if os.name != 'nt' or not os.path.exists("hg.exe"): + if attempt(hgcmd + check_cmd, hgenv): return hgcommand(hgcmd, hgenv) # Fall back to trying the local hg installation. hgenv = localhgenv() hgcmd = [sys.executable, 'hg'] - try: - retcode, out, err = runcmd(hgcmd + check_cmd, hgenv) - except EnvironmentError: - retcode = -1 - if retcode == 0 and not filterhgerr(err): + if attempt(hgcmd + check_cmd, hgenv): return hgcommand(hgcmd, hgenv) eprint("/!\\") eprint(r"/!\ Unable to find a working hg binary") - eprint(r"/!\ Version cannot be extract from the repository") + eprint(r"/!\ Version cannot be extracted from the repository") eprint(r"/!\ Re-run the setup once a first version is built") + eprint(r"/!\ Attempts:") + for i, e in enumerate(attempts): + eprint(r"/!\ attempt #%d:" % (i)) + eprint(r"/!\ cmd: ", e[0]) + res = e[1] + if res[0]: + eprint(r"/!\ return code:", res[1]) + eprint("/!\\ std output:\n%s" % (res[2].decode()), end="") + eprint("/!\\ std error:\n%s" % (res[3].decode()), end="") + else: + eprint(r"/!\ exception: ", res[1]) return None diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -165,6 +165,7 @@ def _bytes2sys(p): return p.decode('utf-8') +original_env = os.environ.copy() osenvironb = getattr(os, 'environb', None) if osenvironb is None: # Windows lacks os.environb, for instance. A proxy over the real thing @@ -3770,7 +3771,7 @@ class TestRunner: makedirs(self._bindir) vlog("# Running", cmd.decode("utf-8")) - if subprocess.call(_bytes2sys(cmd), shell=True) == 0: + if subprocess.call(_bytes2sys(cmd), shell=True, env=original_env) == 0: if not self.options.verbose: try: os.remove(installerrs)