# HG changeset patch # User Kostia Balytskyi <ikos...@fb.com> # Date 1502478965 -10800 # Fri Aug 11 22:16:05 2017 +0300 # Node ID 83de181a018eb0e7ea138121a854a04569140cbe # Parent 85d8ab670c128337f27013168e3f57b037d7996e run_tests: know how to match Windows //?/C:\Something paths
diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -903,7 +903,19 @@ class Test(unittest.TestCase): def _escapepath(self, p): if os.name == 'nt': + # Explanation of the clowntown below: + # We want to match NT prefix \\?\ (see MSDN on Windows File Names). + # In order to match a signle \ in re, we need to escape it with + # another \, thus re has to receive \\ for each \ we want to match. + # Also, to match ?, re has to receive \?. But since we're + # concatenating strings, we can't use r'', so we have to also + # python-string-escape everything. Therefore: + # Want to match | re must receive | python str must contain + # / | // | //// + # ? | /? | //? + # //?/ | /////?// | //////////?//// return ( + b'(\\\\\\\\\\?\\\\){0,1}' + (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c for c in p)) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel