37 # AIX ignores "/" at end of path, others raise EISDIR. |
41 # AIX ignores "/" at end of path, others raise EISDIR. |
38 if util.endswithsep(path): |
42 if util.endswithsep(path): |
39 raise util.Abort(_("path ends in directory separator: %s") % path) |
43 raise util.Abort(_("path ends in directory separator: %s") % path) |
40 parts = util.splitpath(path) |
44 parts = util.splitpath(path) |
41 if (os.path.splitdrive(path)[0] |
45 if (os.path.splitdrive(path)[0] |
42 or parts[0].lower() in ('.hg', '.hg.', '') |
46 or _lowerclean(parts[0]) in ('.hg', '.hg.', '') |
43 or os.pardir in parts): |
47 or os.pardir in parts): |
44 raise util.Abort(_("path contains illegal component: %s") % path) |
48 raise util.Abort(_("path contains illegal component: %s") % path) |
45 if '.hg' in path.lower(): |
49 # Windows shortname aliases |
46 lparts = [p.lower() for p in parts] |
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) |
|
56 if '.hg' in _lowerclean(path): |
|
57 lparts = [_lowerclean(p.lower()) for p in parts] |
47 for p in '.hg', '.hg.': |
58 for p in '.hg', '.hg.': |
48 if p in lparts[1:]: |
59 if p in lparts[1:]: |
49 pos = lparts.index(p) |
60 pos = lparts.index(p) |
50 base = os.path.join(*parts[:pos]) |
61 base = os.path.join(*parts[:pos]) |
51 raise util.Abort(_("path '%s' is inside nested repo %r") |
62 raise util.Abort(_("path '%s' is inside nested repo %r") |