comparison mercurial/pathutil.py @ 23599:6dad422ecc5a stable 3.2.3

pathauditor: check for Windows shortname aliases
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Dec 2014 14:18:28 -0600
parents c02a05cc6f5e
children a4679a74df14
comparison
equal deleted inserted replaced
23598:c02a05cc6f5e 23599:6dad422ecc5a
44 parts = util.splitpath(path) 44 parts = util.splitpath(path)
45 if (os.path.splitdrive(path)[0] 45 if (os.path.splitdrive(path)[0]
46 or _lowerclean(parts[0]) in ('.hg', '.hg.', '') 46 or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
47 or os.pardir in parts): 47 or os.pardir in parts):
48 raise util.Abort(_("path contains illegal component: %s") % path) 48 raise util.Abort(_("path contains illegal component: %s") % path)
49 # Windows shortname aliases
50 for p in parts:
51 if "~" in p:
52 first, last = p.split("~", 1)
53 if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
54 raise util.Abort(_("path contains illegal component: %s")
55 % path)
49 if '.hg' in _lowerclean(path): 56 if '.hg' in _lowerclean(path):
50 lparts = [_lowerclean(p.lower()) for p in parts] 57 lparts = [_lowerclean(p.lower()) for p in parts]
51 for p in '.hg', '.hg.': 58 for p in '.hg', '.hg.':
52 if p in lparts[1:]: 59 if p in lparts[1:]:
53 pos = lparts.index(p) 60 pos = lparts.index(p)