Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 44009:e685fac56693
match: resolve filesets against the passed `cwd`, not the current one
This allows filesets to be resolved relative to `repo.root`, the same as other
patterns are since f02d3c0eed18. The current example in contrib/ wasn't working
from the tests directory because of this.
Differential Revision: https://phab.mercurial-scm.org/D7570
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 06 Dec 2019 20:40:02 -0500 |
parents | 4b7d5d10c45d |
children | a61287a95dc3 |
comparison
equal
deleted
inserted
replaced
44008:ac72e17457e5 | 44009:e685fac56693 |
---|---|
353 | 353 |
354 def fileflags(self, name): | 354 def fileflags(self, name): |
355 """return file flags""" | 355 """return file flags""" |
356 return b'' | 356 return b'' |
357 | 357 |
358 def matchfileset(self, expr, badfn=None): | 358 def matchfileset(self, cwd, expr, badfn=None): |
359 """Resolve the fileset expression for this repo""" | 359 """Resolve the fileset expression for this repo""" |
360 return matchmod.never(badfn=badfn) | 360 return matchmod.never(badfn=badfn) |
361 | 361 |
362 def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): | 362 def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): |
363 """handle the files command for this subrepo""" | 363 """handle the files command for this subrepo""" |
894 rev = self._state[1] | 894 rev = self._state[1] |
895 ctx = self._repo[rev] | 895 ctx = self._repo[rev] |
896 return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, subrepos) | 896 return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, subrepos) |
897 | 897 |
898 @annotatesubrepoerror | 898 @annotatesubrepoerror |
899 def matchfileset(self, expr, badfn=None): | 899 def matchfileset(self, cwd, expr, badfn=None): |
900 if self._ctx.rev() is None: | 900 if self._ctx.rev() is None: |
901 ctx = self._repo[None] | 901 ctx = self._repo[None] |
902 else: | 902 else: |
903 rev = self._state[1] | 903 rev = self._state[1] |
904 ctx = self._repo[rev] | 904 ctx = self._repo[rev] |
905 | 905 |
906 matchers = [ctx.matchfileset(expr, badfn=badfn)] | 906 matchers = [ctx.matchfileset(cwd, expr, badfn=badfn)] |
907 | 907 |
908 for subpath in ctx.substate: | 908 for subpath in ctx.substate: |
909 sub = ctx.sub(subpath) | 909 sub = ctx.sub(subpath) |
910 | 910 |
911 try: | 911 try: |
912 sm = sub.matchfileset(expr, badfn=badfn) | 912 sm = sub.matchfileset(cwd, expr, badfn=badfn) |
913 pm = matchmod.prefixdirmatcher(subpath, sm, badfn=badfn) | 913 pm = matchmod.prefixdirmatcher(subpath, sm, badfn=badfn) |
914 matchers.append(pm) | 914 matchers.append(pm) |
915 except error.LookupError: | 915 except error.LookupError: |
916 self.ui.status( | 916 self.ui.status( |
917 _(b"skipping missing subrepository: %s\n") | 917 _(b"skipping missing subrepository: %s\n") |