mercurial/pathutil.py
branchstable
changeset 23599 6dad422ecc5a
parent 23598 c02a05cc6f5e
child 23602 a4679a74df14
--- a/mercurial/pathutil.py	Tue Dec 16 13:08:17 2014 -0500
+++ b/mercurial/pathutil.py	Thu Dec 18 14:18:28 2014 -0600
@@ -46,6 +46,13 @@
             or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
             or os.pardir in parts):
             raise util.Abort(_("path contains illegal component: %s") % path)
+        # Windows shortname aliases
+        for p in parts:
+            if "~" in p:
+                first, last = p.split("~", 1)
+                if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
+                    raise util.Abort(_("path contains illegal component: %s")
+                                     % path)
         if '.hg' in _lowerclean(path):
             lparts = [_lowerclean(p.lower()) for p in parts]
             for p in '.hg', '.hg.':