<div dir="ltr"><br><br><div class="gmail_quote">On Tue, May 5, 2015 at 8:55 PM Matt Harbison <<a href="mailto:mharbison72@gmail.com">mharbison72@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Matt Harbison <<a href="mailto:matt_harbison@yahoo.com" target="_blank">matt_harbison@yahoo.com</a>><br>
# Date 1430873558 14400<br>
#      Tue May 05 20:52:38 2015 -0400<br>
# Node ID 7d27fb197d23993b076d485f8ae5884ec2e5bcca<br>
# Parent  c5d4f9cc8da7bb2068457e96e4f74ff694514ced<br>
archive: drop the leading '.' path component from the prefix (issue4634)<br>
<br>
Unix utilities like tar will happily prefix the files it packs with './', but<br>
annoyingly, Windows Explorer will not show these packed files when it opens the<br>
archive.  Since there doesn't seem to be a point in including './' in the path<br>
names, just drop it.  The default 'hg archive' prefix is the basename of the<br>
archive, so specifying '.' allows for that default to be disabled completely.<br>
<br>
diff --git a/mercurial/archival.py b/mercurial/archival.py<br>
--- a/mercurial/archival.py<br>
+++ b/mercurial/archival.py<br>
@@ -37,6 +37,10 @@<br>
     prefix = util.pconvert(lpfx)<br>
     if not prefix.endswith('/'):<br>
         prefix += '/'<br>
+    # Drop the leading '.' path component if present, so Windows can read the<br>
+    # zip files (issue4634)<br>
+    if prefix.startswith('./'):<br>
+        prefix = prefix[2:]<br>
     if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix:<br>
         raise util.Abort(_('archive prefix contains illegal components'))<br>
     return prefix<br>
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t<br>
--- a/tests/test-subrepo-deep-nested-change.t<br>
+++ b/tests/test-subrepo-deep-nested-change.t<br>
@@ -309,17 +309,17 @@<br>
<br>
 Exclude normal files from main and sub-sub repo<br>
<br>
-  $ hg --config extensions.largefiles= archive -S -X '**.txt' ../archive_lf.tgz<br>
+  $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz<br>
   $ tar -tzf ../archive_lf.tgz | sort<br>
-  archive_lf/.hgsub<br>
-  archive_lf/.hgsubstate<br>
-  archive_lf/large.bin<br>
-  archive_lf/main<br>
-  archive_lf/sub1/.hgsub<br>
-  archive_lf/sub1/.hgsubstate<br>
-  archive_lf/sub1/sub1<br>
-  archive_lf/sub1/sub2/large.bin<br>
-  archive_lf/sub1/sub2/sub2<br>
+  .hgsub<br>
+  .hgsubstate<br>
+  large.bin<br>
+  main<br>
+  sub1/.hgsub<br>
+  sub1/.hgsubstate<br>
+  sub1/sub1<br>
+  sub1/sub2/large.bin<br>
+  sub1/sub2/sub2<br>
<br>
 Include normal files from within a largefiles subrepo<br>
<br>
diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t<br>
--- a/tests/test-subrepo-git.t<br>
+++ b/tests/test-subrepo-git.t<br>
@@ -325,13 +325,13 @@<br>
   ../archive_x/s<br>
   ../archive_x/s/g<br>
<br>
-  $ hg -R ../tc archive -S ../archive.tgz 2>/dev/null<br>
+  $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null<br>
   $ tar -tzf ../archive.tgz | sort<br>
-  archive/.hg_archival.txt<br>
-  archive/.hgsub<br>
-  archive/.hgsubstate<br>
-  archive/a<br>
-  archive/s/g<br>
+  .hg_archival.txt<br>
+  .hgsub<br>
+  .hgsubstate<br>
+  a<br>
+  s/g<br>
<br>
 create nested repo<br>
<br>
diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t<br>
--- a/tests/test-subrepo-recursion.t<br>
+++ b/tests/test-subrepo-recursion.t<br>
@@ -312,7 +312,7 @@<br>
<br>
 Test archiving to zip file (unzip output is unstable):<br>
<br>
-  $ hg archive --subrepos ../archive.zip<br>
+  $ hg archive --subrepos --prefix '.' ../archive.zip<br>
   \r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
@@ -339,6 +339,20 @@<br>
   archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)<br>
   archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)<br>
                                                               \r (no-eol) (esc)<br>
+  $ unzip -l ../archive.zip<br>
+  Archive:  ../archive.zip<br>
+    Length      Date    Time    Name<br>
+  ---------  ---------- -----   ----<br>
+        172  01-01-1980 00:00   .hg_archival.txt<br>
+         10  01-01-1980 00:00   .hgsub<br>
+         45  01-01-1980 00:00   .hgsubstate<br>
+          3  01-01-1980 00:00   x.txt<br>
+         10  01-01-1980 00:00   foo/.hgsub<br>
+         45  01-01-1980 00:00   foo/.hgsubstate<br>
+          9  01-01-1980 00:00   foo/y.txt<br>
+          9  01-01-1980 00:00   foo/bar/z.txt<br>
+  ---------                     -------<br>
+        303                     8 files<br></blockquote><div><br></div><div>The output format is apparently not very well defined: <a href="http://hgbuildbot.kublai.com/builders/vfat%20hg%20tests/builds/510/steps/vfat/logs/stdio">http://hgbuildbot.kublai.com/builders/vfat%20hg%20tests/builds/510/steps/vfat/logs/stdio</a></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 Test archiving a revision that references a subrepo that is not yet<br>
 cloned:<br>
@@ -363,7 +377,7 @@<br>
<br>
   $ cd ../empty<br>
 #if hardlink<br>
-  $ hg archive --subrepos -r tip ../archive.tar.gz<br>
+  $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz<br>
   \r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
@@ -413,7 +427,7 @@<br>
 #else<br>
 Note there's a slight output glitch on non-hardlink systems: the last<br>
 "linking" progress topic never gets closed, leading to slight output corruption on that platform.<br>
-  $ hg archive --subrepos -r tip ../archive.tar.gz<br>
+  $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz<br>
   \r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
   archiving [                                           ] 0/3\r (no-eol) (esc)<br>
@@ -437,14 +451,14 @@<br>
 Archive + subrepos uses '/' for all component separators<br>
<br>
   $ tar -tzf ../archive.tar.gz | sort<br>
-  archive/.hg_archival.txt<br>
-  archive/.hgsub<br>
-  archive/.hgsubstate<br>
-  archive/foo/.hgsub<br>
-  archive/foo/.hgsubstate<br>
-  archive/foo/bar/z.txt<br>
-  archive/foo/y.txt<br>
-  archive/x.txt<br>
+  .hg_archival.txt<br>
+  .hgsub<br>
+  .hgsubstate<br>
+  foo/.hgsub<br>
+  foo/.hgsubstate<br>
+  foo/bar/z.txt<br>
+  foo/y.txt<br>
+  x.txt<br>
<br>
 The newly cloned subrepos contain no working copy:<br>
<br>
_______________________________________________<br>
Mercurial-devel mailing list<br>
<a href="mailto:Mercurial-devel@selenic.com" target="_blank">Mercurial-devel@selenic.com</a><br>
<a href="http://selenic.com/mailman/listinfo/mercurial-devel" target="_blank">http://selenic.com/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div></div>