comparison mercurial/subrepo.py @ 38613:760cc5dc01e8

fileset: restrict getfileset() to not return a computed set (API) And rename the functions accordingly. fileset.match() will be changed to not compute the initial subset. test-glog*.t get back to the state before 9f9ffe5f687c "match: compose 'set:' pattern as matcher."
author Yuya Nishihara <yuya@tcha.org>
date Sat, 09 Jun 2018 20:53:12 +0900
parents 3a7c33a2cc5e
children 41ac8ea1bdd7
comparison
equal deleted inserted replaced
38612:0ba4cf3f088f 38613:760cc5dc01e8
316 316
317 def fileflags(self, name): 317 def fileflags(self, name):
318 """return file flags""" 318 """return file flags"""
319 return '' 319 return ''
320 320
321 def getfileset(self, expr): 321 def matchfileset(self, expr, badfn=None):
322 """Resolve the fileset expression for this repo""" 322 """Resolve the fileset expression for this repo"""
323 return set() 323 return matchmod.nevermatcher(self.wvfs.base, '', badfn=badfn)
324 324
325 def printfiles(self, ui, m, fm, fmt, subrepos): 325 def printfiles(self, ui, m, fm, fmt, subrepos):
326 """handle the files command for this subrepo""" 326 """handle the files command for this subrepo"""
327 return 1 327 return 1
328 328
790 rev = self._state[1] 790 rev = self._state[1]
791 ctx = self._repo[rev] 791 ctx = self._repo[rev]
792 return cmdutil.files(ui, ctx, m, fm, fmt, subrepos) 792 return cmdutil.files(ui, ctx, m, fm, fmt, subrepos)
793 793
794 @annotatesubrepoerror 794 @annotatesubrepoerror
795 def getfileset(self, expr): 795 def matchfileset(self, expr, badfn=None):
796 repo = self._repo
796 if self._ctx.rev() is None: 797 if self._ctx.rev() is None:
797 ctx = self._repo[None] 798 ctx = repo[None]
798 else: 799 else:
799 rev = self._state[1] 800 rev = self._state[1]
800 ctx = self._repo[rev] 801 ctx = repo[rev]
801 802
802 files = ctx.getfileset(expr) 803 matchers = [ctx.matchfileset(expr, badfn=badfn)]
803 804
804 for subpath in ctx.substate: 805 for subpath in ctx.substate:
805 sub = ctx.sub(subpath) 806 sub = ctx.sub(subpath)
806 807
807 try: 808 try:
808 files.extend(subpath + '/' + f for f in sub.getfileset(expr)) 809 sm = sub.matchfileset(expr, badfn=badfn)
810 pm = matchmod.prefixdirmatcher(repo.root, repo.getcwd(),
811 subpath, sm, badfn=badfn)
812 matchers.append(pm)
809 except error.LookupError: 813 except error.LookupError:
810 self.ui.status(_("skipping missing subrepository: %s\n") 814 self.ui.status(_("skipping missing subrepository: %s\n")
811 % self.wvfs.reljoin(reporelpath(self), subpath)) 815 % self.wvfs.reljoin(reporelpath(self), subpath))
812 return files 816 if len(matchers) == 1:
817 return matchers[0]
818 return matchmod.unionmatcher(matchers)
813 819
814 def walk(self, match): 820 def walk(self, match):
815 ctx = self._repo[None] 821 ctx = self._repo[None]
816 return ctx.walk(match) 822 return ctx.walk(match)
817 823