comparison mercurial/subrepo.py @ 25556:df63d4843581

subrepo: introduce getfileset() This will be used in the next patch to help matchers resolve filesets in subrepos. The default implementation returns an empty set (for git and svn).
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 15 May 2015 23:13:05 -0400
parents 3e39f67ef663
children ca9c02cb81be
comparison
equal deleted inserted replaced
25555:a7701001c829 25556:df63d4843581
498 498
499 def fileflags(self, name): 499 def fileflags(self, name):
500 """return file flags""" 500 """return file flags"""
501 return '' 501 return ''
502 502
503 def getfileset(self, expr):
504 """Resolve the fileset expression for this repo"""
505 return set()
506
503 def printfiles(self, ui, m, fm, fmt): 507 def printfiles(self, ui, m, fm, fmt):
504 """handle the files command for this subrepo""" 508 """handle the files command for this subrepo"""
505 return 1 509 return 1
506 510
507 def archive(self, archiver, prefix, match=None): 511 def archive(self, archiver, prefix, match=None):
914 ctx = self._repo[None] 918 ctx = self._repo[None]
915 else: 919 else:
916 rev = self._state[1] 920 rev = self._state[1]
917 ctx = self._repo[rev] 921 ctx = self._repo[rev]
918 return cmdutil.files(ui, ctx, m, fm, fmt, True) 922 return cmdutil.files(ui, ctx, m, fm, fmt, True)
923
924 @annotatesubrepoerror
925 def getfileset(self, expr):
926 if self._ctx.rev() is None:
927 ctx = self._repo[None]
928 else:
929 rev = self._state[1]
930 ctx = self._repo[rev]
931
932 files = ctx.getfileset(expr)
933
934 for subpath in ctx.substate:
935 sub = ctx.sub(subpath)
936
937 try:
938 files.extend(subpath + '/' + f for f in sub.getfileset(expr))
939 except error.LookupError:
940 self.ui.status(_("skipping missing subrepository: %s\n")
941 % self.wvfs.reljoin(reporelpath(self), subpath))
942 return files
919 943
920 def walk(self, match): 944 def walk(self, match):
921 ctx = self._repo[None] 945 ctx = self._repo[None]
922 return ctx.walk(match) 946 return ctx.walk(match)
923 947