Mercurial > hg
diff mercurial/context.py @ 25122:755d23a49170
match: resolve filesets in subrepos for commands given the '-S' argument
This will work for any command that creates its matcher via scmutil.match(), but
only the files command is tested here (both workingctx and basectx based tests).
The previous behavior was to completely ignore the files in the subrepo, even
though -S was given.
My first attempt was to teach context.walk() to optionally recurse, but once
that was in place and the complete file list was built up, the predicate test
would fail with 'path in nested repo' when a file in a subrepo was accessed
through the parent context.
There are two slightly surprising behaviors with this functionality. First, any
path provided inside the fileset isn't narrowed when it is passed to the
subrepo. I dont see any clean way to do that in the matcher. Fortunately, the
'subrepo()' fileset is the only one to take a path.
The second surprise is that status predicates are resolved against the subrepo,
not the parent like 'hg status -S' is. I don't see any way to fix that either,
given the path auditor error mentioned above.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 16 May 2015 00:36:35 -0400 |
parents | d9fb88c045a0 |
children | 472a685a4961 |
line wrap: on
line diff
--- a/mercurial/context.py Fri May 15 23:13:05 2015 -0400 +++ b/mercurial/context.py Sat May 16 00:36:35 2015 -0400 @@ -251,11 +251,13 @@ def sub(self, path): return subrepo.subrepo(self, path) - def match(self, pats=[], include=None, exclude=None, default='glob'): + def match(self, pats=[], include=None, exclude=None, default='glob', + listsubrepos=False): r = self._repo return matchmod.match(r.root, r.getcwd(), pats, include, exclude, default, - auditor=r.auditor, ctx=self) + auditor=r.auditor, ctx=self, + listsubrepos=listsubrepos) def diff(self, ctx2=None, match=None, **opts): """Returns a diff generator for the given contexts and matcher""" @@ -1437,17 +1439,20 @@ finally: wlock.release() - def match(self, pats=[], include=None, exclude=None, default='glob'): + def match(self, pats=[], include=None, exclude=None, default='glob', + listsubrepos=False): r = self._repo # Only a case insensitive filesystem needs magic to translate user input # to actual case in the filesystem. if not util.checkcase(r.root): return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, - exclude, default, r.auditor, self) + exclude, default, r.auditor, self, + listsubrepos=listsubrepos) return matchmod.match(r.root, r.getcwd(), pats, include, exclude, default, - auditor=r.auditor, ctx=self) + auditor=r.auditor, ctx=self, + listsubrepos=listsubrepos) def _filtersuspectsymlink(self, files): if not files or self._repo.dirstate._checklink: