Mercurial > hg-stable
comparison mercurial/context.py @ 42320:4fbfc893e6b9
context: move walk() and match() overrides from committablectx to workingctx
Same reasoning as previous commit: these functions update the dirstate.
Differential Revision: https://phab.mercurial-scm.org/D6363
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 10 May 2019 21:53:41 -0700 |
parents | 491855ea9d62 |
children | fdd4d668ceb5 |
comparison
equal
deleted
inserted
replaced
42319:491855ea9d62 | 42320:4fbfc893e6b9 |
---|---|
1207 | 1207 |
1208 def ancestor(self, c2): | 1208 def ancestor(self, c2): |
1209 """return the "best" ancestor context of self and c2""" | 1209 """return the "best" ancestor context of self and c2""" |
1210 return self._parents[0].ancestor(c2) # punt on two parents for now | 1210 return self._parents[0].ancestor(c2) # punt on two parents for now |
1211 | 1211 |
1212 def walk(self, match): | |
1213 '''Generates matching file names.''' | |
1214 return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match), | |
1215 subrepos=sorted(self.substate), | |
1216 unknown=True, ignored=False)) | |
1217 | |
1218 def matches(self, match): | |
1219 match = self._repo.narrowmatch(match) | |
1220 ds = self._repo.dirstate | |
1221 return sorted(f for f in ds.matches(match) if ds[f] != 'r') | |
1222 | |
1223 def ancestors(self): | 1212 def ancestors(self): |
1224 for p in self._parents: | 1213 for p in self._parents: |
1225 yield p | 1214 yield p |
1226 for a in self._repo.changelog.ancestors( | 1215 for a in self._repo.changelog.ancestors( |
1227 [p.rev() for p in self._parents]): | 1216 [p.rev() for p in self._parents]): |
1654 self._repo.ui.warn('%s: %s\n' % | 1643 self._repo.ui.warn('%s: %s\n' % |
1655 (self._repo.dirstate.pathto(f), msg)) | 1644 (self._repo.dirstate.pathto(f), msg)) |
1656 match.bad = bad | 1645 match.bad = bad |
1657 return match | 1646 return match |
1658 | 1647 |
1648 def walk(self, match): | |
1649 '''Generates matching file names.''' | |
1650 return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match), | |
1651 subrepos=sorted(self.substate), | |
1652 unknown=True, ignored=False)) | |
1653 | |
1654 def matches(self, match): | |
1655 match = self._repo.narrowmatch(match) | |
1656 ds = self._repo.dirstate | |
1657 return sorted(f for f in ds.matches(match) if ds[f] != 'r') | |
1658 | |
1659 def markcommitted(self, node): | 1659 def markcommitted(self, node): |
1660 super(workingctx, self).markcommitted(node) | 1660 super(workingctx, self).markcommitted(node) |
1661 | 1661 |
1662 sparse.aftercommit(self._repo, node) | 1662 sparse.aftercommit(self._repo, node) |
1663 | 1663 |