Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 25193:ccb1623266eb stable
context: don't complain about a matcher's subrepo paths in changectx.walk()
Previously, the first added test printed the following:
$ hg files -S -r '.^' sub1/sub2/folder
sub1/sub2/folder: no such file in rev 9bb10eebee29
sub1/sub2/folder: no such file in rev 9bb10eebee29
sub1/sub2/folder/test.txt
One warning occured each time a subrepo was crossed into.
The second test ensures that the matcher copy stays in place. Without the copy,
the bad() function becomes an increasingly longer chain, and no message would be
printed out for a file missing in the subrepo because the predicate would match
in one of the replaced methods. Manifest doesn't know anything about subrepos,
so it needs help ignoring subrepos when complaining about bad files.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 17 May 2015 01:06:10 -0400 |
parents | c82d88dfaf59 |
children | 472a685a4961 |
comparison
equal
deleted
inserted
replaced
25192:36111f98f23d | 25193:ccb1623266eb |
---|---|
7 | 7 |
8 from node import nullid, nullrev, short, hex, bin | 8 from node import nullid, nullrev, short, hex, bin |
9 from i18n import _ | 9 from i18n import _ |
10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases | 10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases |
11 import match as matchmod | 11 import match as matchmod |
12 import os, errno, stat | 12 import copy, os, errno, stat |
13 import obsolete as obsmod | 13 import obsolete as obsmod |
14 import repoview | 14 import repoview |
15 import fileset | 15 import fileset |
16 import revlog | 16 import revlog |
17 | 17 |
588 | 588 |
589 def walk(self, match): | 589 def walk(self, match): |
590 '''Generates matching file names.''' | 590 '''Generates matching file names.''' |
591 | 591 |
592 # Override match.bad method to have message with nodeid | 592 # Override match.bad method to have message with nodeid |
593 match = copy.copy(match) | |
593 oldbad = match.bad | 594 oldbad = match.bad |
594 def bad(fn, msg): | 595 def bad(fn, msg): |
596 # The manifest doesn't know about subrepos, so don't complain about | |
597 # paths into valid subrepos. | |
598 if util.any(fn == s or fn.startswith(s + '/') | |
599 for s in self.substate): | |
600 return | |
595 oldbad(fn, _('no such file in rev %s') % self) | 601 oldbad(fn, _('no such file in rev %s') % self) |
596 match.bad = bad | 602 match.bad = bad |
597 | 603 |
598 return self._manifest.walk(match) | 604 return self._manifest.walk(match) |
599 | 605 |