Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 24924:41cd8171e58f stable
archive: always use portable path component separators with subrepos
The previous behavior when archiving a subrepo 's' on Windows was to internally
name the file under it 's\file', due to the use of vfs.reljoin(). When printing
the file list from the archive on Windows or Linux, the file was named
's\\file'. The archive extracted OK on Windows, but if the archive was brought
to a Linux system, it created a file named 's\file' instead of a directory 's'
containing 'file'.
*.zip format achives seemed not to have the problem, but this was definitely an
issue with *.tgz archives.
Largefiles actually got this right, but a test is added to keep this from
regressing. The subrepo-deep-nested-change.t test was repurposed to archive to
a file, since there are several subsequent tests that archive to a directory.
The output change is losing the filesystem prefix '../archive_lf' and not
listing the directories 'sub1' and 'sub1/sub2'.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 04 May 2015 22:33:29 -0400 |
parents | cc497780eaf9 |
children | 3e39f67ef663 |
comparison
equal
deleted
inserted
replaced
24920:b5eb01500696 | 24924:41cd8171e58f |
---|---|
515 unit=_('files'), total=total) | 515 unit=_('files'), total=total) |
516 for i, name in enumerate(files): | 516 for i, name in enumerate(files): |
517 flags = self.fileflags(name) | 517 flags = self.fileflags(name) |
518 mode = 'x' in flags and 0755 or 0644 | 518 mode = 'x' in flags and 0755 or 0644 |
519 symlink = 'l' in flags | 519 symlink = 'l' in flags |
520 archiver.addfile(self.wvfs.reljoin(prefix, self._path, name), | 520 archiver.addfile(prefix + self._path + '/' + name, |
521 mode, symlink, self.filedata(name)) | 521 mode, symlink, self.filedata(name)) |
522 self.ui.progress(_('archiving (%s)') % relpath, i + 1, | 522 self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
523 unit=_('files'), total=total) | 523 unit=_('files'), total=total) |
524 self.ui.progress(_('archiving (%s)') % relpath, None) | 524 self.ui.progress(_('archiving (%s)') % relpath, None) |
525 return total | 525 return total |
729 rev = self._state[1] | 729 rev = self._state[1] |
730 ctx = self._repo[rev] | 730 ctx = self._repo[rev] |
731 for subpath in ctx.substate: | 731 for subpath in ctx.substate: |
732 s = subrepo(ctx, subpath) | 732 s = subrepo(ctx, subpath) |
733 submatch = matchmod.narrowmatcher(subpath, match) | 733 submatch = matchmod.narrowmatcher(subpath, match) |
734 total += s.archive( | 734 total += s.archive(archiver, prefix + self._path + '/', submatch) |
735 archiver, self.wvfs.reljoin(prefix, self._path), submatch) | |
736 return total | 735 return total |
737 | 736 |
738 @annotatesubrepoerror | 737 @annotatesubrepoerror |
739 def dirty(self, ignoreupdate=False): | 738 def dirty(self, ignoreupdate=False): |
740 r = self._state[1] | 739 r = self._state[1] |
1673 continue | 1672 continue |
1674 if info.issym(): | 1673 if info.issym(): |
1675 data = info.linkname | 1674 data = info.linkname |
1676 else: | 1675 else: |
1677 data = tar.extractfile(info).read() | 1676 data = tar.extractfile(info).read() |
1678 archiver.addfile(self.wvfs.reljoin(prefix, self._path, info.name), | 1677 archiver.addfile(prefix + self._path + '/' + info.name, |
1679 info.mode, info.issym(), data) | 1678 info.mode, info.issym(), data) |
1680 total += 1 | 1679 total += 1 |
1681 self.ui.progress(_('archiving (%s)') % relpath, i + 1, | 1680 self.ui.progress(_('archiving (%s)') % relpath, i + 1, |
1682 unit=_('files')) | 1681 unit=_('files')) |
1683 self.ui.progress(_('archiving (%s)') % relpath, None) | 1682 self.ui.progress(_('archiving (%s)') % relpath, None) |