Show More
@@ -890,16 +890,16 b' def overridearchive(orig, repo, dest, no' | |||
|
890 | 890 | for subpath in sorted(ctx.substate): |
|
891 | 891 | sub = ctx.sub(subpath) |
|
892 | 892 | submatch = match_.narrowmatcher(subpath, matchfn) |
|
893 |
sub.archive( |
|
|
893 | sub.archive(archiver, prefix, submatch) | |
|
894 | 894 | |
|
895 | 895 | archiver.done() |
|
896 | 896 | |
|
897 |
def hgsubrepoarchive(orig, repo |
|
|
897 | def hgsubrepoarchive(orig, repo, archiver, prefix, match=None): | |
|
898 | 898 | repo._get(repo._state + ('hg',)) |
|
899 | 899 | rev = repo._state[1] |
|
900 | 900 | ctx = repo._repo[rev] |
|
901 | 901 | |
|
902 | lfcommands.cachelfiles(ui, repo._repo, ctx.node()) | |
|
902 | lfcommands.cachelfiles(repo.ui, repo._repo, ctx.node()) | |
|
903 | 903 | |
|
904 | 904 | def write(name, mode, islink, getdata): |
|
905 | 905 | # At this point, the standin has been replaced with the largefile name, |
@@ -937,8 +937,7 b' def hgsubrepoarchive(orig, repo, ui, arc' | |||
|
937 | 937 | for subpath in sorted(ctx.substate): |
|
938 | 938 | sub = ctx.sub(subpath) |
|
939 | 939 | submatch = match_.narrowmatcher(subpath, match) |
|
940 |
sub.archive( |
|
|
941 | submatch) | |
|
940 | sub.archive(archiver, os.path.join(prefix, repo._path) + '/', submatch) | |
|
942 | 941 | |
|
943 | 942 | # If a largefile is modified, the change is not reflected in its |
|
944 | 943 | # standin until a commit. cmdutil.bailifchanged() raises an exception |
@@ -304,7 +304,7 b' def archive(repo, dest, node, kind, deco' | |||
|
304 | 304 | for subpath in sorted(ctx.substate): |
|
305 | 305 | sub = ctx.sub(subpath) |
|
306 | 306 | submatch = matchmod.narrowmatcher(subpath, matchfn) |
|
307 |
total += sub.archive( |
|
|
307 | total += sub.archive(archiver, prefix, submatch) | |
|
308 | 308 | |
|
309 | 309 | if total == 0: |
|
310 | 310 | raise error.Abort(_('no files match the archive pattern')) |
@@ -469,24 +469,24 b' class abstractsubrepo(object):' | |||
|
469 | 469 | """return file flags""" |
|
470 | 470 | return '' |
|
471 | 471 | |
|
472 |
def archive(self |
|
|
472 | def archive(self, archiver, prefix, match=None): | |
|
473 | 473 | if match is not None: |
|
474 | 474 | files = [f for f in self.files() if match(f)] |
|
475 | 475 | else: |
|
476 | 476 | files = self.files() |
|
477 | 477 | total = len(files) |
|
478 | 478 | relpath = subrelpath(self) |
|
479 | ui.progress(_('archiving (%s)') % relpath, 0, | |
|
480 | unit=_('files'), total=total) | |
|
479 | self.ui.progress(_('archiving (%s)') % relpath, 0, | |
|
480 | unit=_('files'), total=total) | |
|
481 | 481 | for i, name in enumerate(files): |
|
482 | 482 | flags = self.fileflags(name) |
|
483 | 483 | mode = 'x' in flags and 0755 or 0644 |
|
484 | 484 | symlink = 'l' in flags |
|
485 | 485 | archiver.addfile(os.path.join(prefix, self._path, name), |
|
486 | 486 | mode, symlink, self.filedata(name)) |
|
487 | ui.progress(_('archiving (%s)') % relpath, i + 1, | |
|
488 | unit=_('files'), total=total) | |
|
489 | ui.progress(_('archiving (%s)') % relpath, None) | |
|
487 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, | |
|
488 | unit=_('files'), total=total) | |
|
489 | self.ui.progress(_('archiving (%s)') % relpath, None) | |
|
490 | 490 | return total |
|
491 | 491 | |
|
492 | 492 | def walk(self, match): |
@@ -670,16 +670,16 b' class hgsubrepo(abstractsubrepo):' | |||
|
670 | 670 | % (inst, subrelpath(self))) |
|
671 | 671 | |
|
672 | 672 | @annotatesubrepoerror |
|
673 |
def archive(self |
|
|
673 | def archive(self, archiver, prefix, match=None): | |
|
674 | 674 | self._get(self._state + ('hg',)) |
|
675 |
total = abstractsubrepo.archive(self, |
|
|
675 | total = abstractsubrepo.archive(self, archiver, prefix, match) | |
|
676 | 676 | rev = self._state[1] |
|
677 | 677 | ctx = self._repo[rev] |
|
678 | 678 | for subpath in ctx.substate: |
|
679 | 679 | s = subrepo(ctx, subpath) |
|
680 | 680 | submatch = matchmod.narrowmatcher(subpath, match) |
|
681 | 681 | total += s.archive( |
|
682 |
|
|
|
682 | archiver, os.path.join(prefix, self._path), submatch) | |
|
683 | 683 | return total |
|
684 | 684 | |
|
685 | 685 | @annotatesubrepoerror |
@@ -1543,7 +1543,7 b' class gitsubrepo(abstractsubrepo):' | |||
|
1543 | 1543 | else: |
|
1544 | 1544 | os.remove(path) |
|
1545 | 1545 | |
|
1546 |
def archive(self |
|
|
1546 | def archive(self, archiver, prefix, match=None): | |
|
1547 | 1547 | total = 0 |
|
1548 | 1548 | source, revision = self._state |
|
1549 | 1549 | if not revision: |
@@ -1556,7 +1556,7 b' class gitsubrepo(abstractsubrepo):' | |||
|
1556 | 1556 | tarstream = self._gitcommand(['archive', revision], stream=True) |
|
1557 | 1557 | tar = tarfile.open(fileobj=tarstream, mode='r|') |
|
1558 | 1558 | relpath = subrelpath(self) |
|
1559 | ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) | |
|
1559 | self.ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files')) | |
|
1560 | 1560 | for i, info in enumerate(tar): |
|
1561 | 1561 | if info.isdir(): |
|
1562 | 1562 | continue |
@@ -1569,9 +1569,9 b' class gitsubrepo(abstractsubrepo):' | |||
|
1569 | 1569 | archiver.addfile(os.path.join(prefix, self._path, info.name), |
|
1570 | 1570 | info.mode, info.issym(), data) |
|
1571 | 1571 | total += 1 |
|
1572 | ui.progress(_('archiving (%s)') % relpath, i + 1, | |
|
1573 | unit=_('files')) | |
|
1574 | ui.progress(_('archiving (%s)') % relpath, None) | |
|
1572 | self.ui.progress(_('archiving (%s)') % relpath, i + 1, | |
|
1573 | unit=_('files')) | |
|
1574 | self.ui.progress(_('archiving (%s)') % relpath, None) | |
|
1575 | 1575 | return total |
|
1576 | 1576 | |
|
1577 | 1577 |
General Comments 0
You need to be logged in to leave comments.
Login now