equal
deleted
inserted
replaced
361 |
361 |
362 def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): |
362 def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): |
363 """handle the files command for this subrepo""" |
363 """handle the files command for this subrepo""" |
364 return 1 |
364 return 1 |
365 |
365 |
366 def archive(self, archiver, prefix, match=None, decode=True): |
366 def archive(self, archiver, prefix, match, decode=True): |
367 if match is not None: |
367 files = [f for f in self.files() if match(f)] |
368 files = [f for f in self.files() if match(f)] |
|
369 else: |
|
370 files = self.files() |
|
371 total = len(files) |
368 total = len(files) |
372 relpath = subrelpath(self) |
369 relpath = subrelpath(self) |
373 progress = self.ui.makeprogress( |
370 progress = self.ui.makeprogress( |
374 _(b'archiving (%s)') % relpath, unit=_(b'files'), total=total |
371 _(b'archiving (%s)') % relpath, unit=_(b'files'), total=total |
375 ) |
372 ) |
650 _(b'warning: error "%s" in subrepository "%s"\n') |
647 _(b'warning: error "%s" in subrepository "%s"\n') |
651 % (inst, subrelpath(self)) |
648 % (inst, subrelpath(self)) |
652 ) |
649 ) |
653 |
650 |
654 @annotatesubrepoerror |
651 @annotatesubrepoerror |
655 def archive(self, archiver, prefix, match=None, decode=True): |
652 def archive(self, archiver, prefix, match, decode=True): |
656 self._get(self._state + (b'hg',)) |
653 self._get(self._state + (b'hg',)) |
657 files = self.files() |
654 files = [f for f in self.files() if match(f)] |
658 if match: |
|
659 files = [f for f in files if match(f)] |
|
660 rev = self._state[1] |
655 rev = self._state[1] |
661 ctx = self._repo[rev] |
656 ctx = self._repo[rev] |
662 scmutil.prefetchfiles( |
657 scmutil.prefetchfiles( |
663 self._repo, [(ctx.rev(), scmutil.matchfiles(self._repo, files))] |
658 self._repo, [(ctx.rev(), scmutil.matchfiles(self._repo, files))] |
664 ) |
659 ) |
1909 if kind == stat.S_IFDIR: |
1904 if kind == stat.S_IFDIR: |
1910 self.wvfs.rmtree(f) |
1905 self.wvfs.rmtree(f) |
1911 else: |
1906 else: |
1912 self.wvfs.unlink(f) |
1907 self.wvfs.unlink(f) |
1913 |
1908 |
1914 def archive(self, archiver, prefix, match=None, decode=True): |
1909 def archive(self, archiver, prefix, match, decode=True): |
1915 total = 0 |
1910 total = 0 |
1916 source, revision = self._state |
1911 source, revision = self._state |
1917 if not revision: |
1912 if not revision: |
1918 return total |
1913 return total |
1919 self._fetch(source, revision) |
1914 self._fetch(source, revision) |
1930 progress.update(0) |
1925 progress.update(0) |
1931 for info in tar: |
1926 for info in tar: |
1932 if info.isdir(): |
1927 if info.isdir(): |
1933 continue |
1928 continue |
1934 bname = pycompat.fsencode(info.name) |
1929 bname = pycompat.fsencode(info.name) |
1935 if match and not match(bname): |
1930 if not match(bname): |
1936 continue |
1931 continue |
1937 if info.issym(): |
1932 if info.issym(): |
1938 data = info.linkname |
1933 data = info.linkname |
1939 else: |
1934 else: |
1940 f = tar.extractfile(info) |
1935 f = tar.extractfile(info) |