diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -517,7 +517,7 @@ class abstractsubrepo(object): flags = self.fileflags(name) mode = 'x' in flags and 0755 or 0644 symlink = 'l' in flags - archiver.addfile(self.wvfs.reljoin(prefix, self._path, name), + archiver.addfile(prefix + self._path + '/' + name, mode, symlink, self.filedata(name)) self.ui.progress(_('archiving (%s)') % relpath, i + 1, unit=_('files'), total=total) @@ -731,8 +731,7 @@ class hgsubrepo(abstractsubrepo): for subpath in ctx.substate: s = subrepo(ctx, subpath) submatch = matchmod.narrowmatcher(subpath, match) - total += s.archive( - archiver, self.wvfs.reljoin(prefix, self._path), submatch) + total += s.archive(archiver, prefix + self._path + '/', submatch) return total @annotatesubrepoerror @@ -1675,7 +1674,7 @@ class gitsubrepo(abstractsubrepo): data = info.linkname else: data = tar.extractfile(info).read() - archiver.addfile(self.wvfs.reljoin(prefix, self._path, info.name), + archiver.addfile(prefix + self._path + '/' + info.name, info.mode, info.issym(), data) total += 1 self.ui.progress(_('archiving (%s)') % relpath, i + 1, diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t --- a/tests/test-subrepo-deep-nested-change.t +++ b/tests/test-subrepo-deep-nested-change.t @@ -309,21 +309,17 @@ Exclude large files from main and sub-su Exclude normal files from main and sub-sub repo - $ hg --config extensions.largefiles= archive -S -X '**.txt' ../archive_lf - $ find ../archive_lf | sort - ../archive_lf - ../archive_lf/.hgsub - ../archive_lf/.hgsubstate - ../archive_lf/large.bin - ../archive_lf/main - ../archive_lf/sub1 - ../archive_lf/sub1/.hgsub - ../archive_lf/sub1/.hgsubstate - ../archive_lf/sub1/sub1 - ../archive_lf/sub1/sub2 - ../archive_lf/sub1/sub2/large.bin - ../archive_lf/sub1/sub2/sub2 - $ rm -rf ../archive_lf + $ hg --config extensions.largefiles= archive -S -X '**.txt' ../archive_lf.tgz + $ tar -tzf ../archive_lf.tgz | sort + archive_lf/.hgsub + archive_lf/.hgsubstate + archive_lf/large.bin + archive_lf/main + archive_lf/sub1/.hgsub + archive_lf/sub1/.hgsubstate + archive_lf/sub1/sub1 + archive_lf/sub1/sub2/large.bin + archive_lf/sub1/sub2/sub2 Include normal files from within a largefiles subrepo diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t +++ b/tests/test-subrepo-git.t @@ -325,6 +325,14 @@ archive subrepos ../archive_x/s ../archive_x/s/g + $ hg -R ../tc archive -S ../archive.tgz 2>/dev/null + $ tar -tzf ../archive.tgz | sort + archive/.hg_archival.txt + archive/.hgsub + archive/.hgsubstate + archive/a + archive/s/g + create nested repo $ cd .. diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -434,6 +434,18 @@ Note there's a slight output glitch on n cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob) #endif +Archive + subrepos uses '/' for all component separators + + $ tar -tzf ../archive.tar.gz | sort + archive/.hg_archival.txt + archive/.hgsub + archive/.hgsubstate + archive/foo/.hgsub + archive/foo/.hgsubstate + archive/foo/bar/z.txt + archive/foo/y.txt + archive/x.txt + The newly cloned subrepos contain no working copy: $ hg -R foo summary