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