mercurial/subrepo.py
changeset 52741 5c48fd4c0e68
parent 52643 5cc8deb96b48
equal deleted inserted replaced
52740:7405f8a67611 52741:5c48fd4c0e68
    16 import sys
    16 import sys
    17 import tarfile
    17 import tarfile
    18 import xml.dom.minidom
    18 import xml.dom.minidom
    19 
    19 
    20 from .i18n import _
    20 from .i18n import _
       
    21 from .interfaces.types import (
       
    22     MatcherT,
       
    23 )
    21 from .node import (
    24 from .node import (
    22     bin,
    25     bin,
    23     hex,
    26     hex,
    24     short,
    27     short,
    25 )
    28 )
   365 
   368 
   366     def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos):
   369     def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos):
   367         """handle the files command for this subrepo"""
   370         """handle the files command for this subrepo"""
   368         return 1
   371         return 1
   369 
   372 
   370     def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
   373     def archive(self, opener, prefix, match: MatcherT, decode=True):
   371         files = [f for f in self.files() if match(f)]
   374         files = [f for f in self.files() if match(f)]
   372         total = len(files)
   375         total = len(files)
   373         relpath = subrelpath(self)
   376         relpath = subrelpath(self)
   374         progress = self.ui.makeprogress(
   377         progress = self.ui.makeprogress(
   375             _(b'archiving (%s)') % relpath, unit=_(b'files'), total=total
   378             _(b'archiving (%s)') % relpath, unit=_(b'files'), total=total
   654                 _(b'warning: error "%s" in subrepository "%s"\n')
   657                 _(b'warning: error "%s" in subrepository "%s"\n')
   655                 % (inst, subrelpath(self))
   658                 % (inst, subrelpath(self))
   656             )
   659             )
   657 
   660 
   658     @annotatesubrepoerror
   661     @annotatesubrepoerror
   659     def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
   662     def archive(self, opener, prefix, match: MatcherT, decode=True):
   660         self._get(self._state + (b'hg',))
   663         self._get(self._state + (b'hg',))
   661         files = [f for f in self.files() if match(f)]
   664         files = [f for f in self.files() if match(f)]
   662         rev = self._state[1]
   665         rev = self._state[1]
   663         ctx = self._repo[rev]
   666         ctx = self._repo[rev]
   664         scmutil.prefetchfiles(
   667         scmutil.prefetchfiles(
  1911             if kind == stat.S_IFDIR:
  1914             if kind == stat.S_IFDIR:
  1912                 self.wvfs.rmtree(f)
  1915                 self.wvfs.rmtree(f)
  1913             else:
  1916             else:
  1914                 self.wvfs.unlink(f)
  1917                 self.wvfs.unlink(f)
  1915 
  1918 
  1916     def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
  1919     def archive(self, opener, prefix, match: MatcherT, decode=True):
  1917         total = 0
  1920         total = 0
  1918         source, revision = self._state
  1921         source, revision = self._state
  1919         if not revision:
  1922         if not revision:
  1920             return total
  1923             return total
  1921         self._fetch(source, revision)
  1924         self._fetch(source, revision)