diff 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
line wrap: on
line diff
--- 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.':