# HG changeset patch # User Arseniy Alekseyev # Date 1672857740 0 # Node ID 44deb5a164dcb4537042f40f66c089f67a988ef7 # Parent becd16690cbe59b5f02749c35b603b9ec48c1579 pathutil: slightly faster path audit in the common case diff -r becd16690cbe -r 44deb5a164dc mercurial/pathutil.py --- a/mercurial/pathutil.py Fri Jan 06 16:01:31 2023 +0000 +++ b/mercurial/pathutil.py Wed Jan 04 18:42:20 2023 +0000 @@ -90,13 +90,14 @@ _(b"path contains illegal component: %s") % path ) # Windows shortname aliases - for p in parts: - if b"~" in p: - first, last = p.split(b"~", 1) - if last.isdigit() and first.upper() in [b"HG", b"HG8B6C"]: - raise error.InputError( - _(b"path contains illegal component: %s") % path - ) + if b"~" in path: + for p in parts: + if b"~" in p: + first, last = p.split(b"~", 1) + if last.isdigit() and first.upper() in [b"HG", b"HG8B6C"]: + raise error.InputError( + _(b"path contains illegal component: %s") % path + ) if b'.hg' in _lowerclean(path): lparts = [_lowerclean(p) for p in parts] for p in b'.hg', b'.hg.':