diff mercurial/archival.py @ 24953:5115d03440f4

archive: drop the leading '.' path component from the prefix (issue4634) Unix utilities like tar will happily prefix the files it packs with './', but annoyingly, Windows Explorer will not show these packed files when it opens the archive. Since there doesn't seem to be a point in including './' in the path names, just drop it. The default 'hg archive' prefix is the basename of the archive, so specifying '.' allows for that default to be disabled completely.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 05 May 2015 20:52:38 -0400
parents 33ab99a6ad9b
children 3f0744eeaeaf
line wrap: on
line diff
--- a/mercurial/archival.py	Thu May 07 13:47:45 2015 -0500
+++ b/mercurial/archival.py	Tue May 05 20:52:38 2015 -0400
@@ -37,6 +37,10 @@
     prefix = util.pconvert(lpfx)
     if not prefix.endswith('/'):
         prefix += '/'
+    # Drop the leading '.' path component if present, so Windows can read the
+    # zip files (issue4634)
+    if prefix.startswith('./'):
+        prefix = prefix[2:]
     if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix:
         raise util.Abort(_('archive prefix contains illegal components'))
     return prefix