comparison mercurial/context.py @ 24326:637da5711122

manifest: have context use self.hasdir() A couple places in context currently use "x in self._dirs" to check for the existence of the directory, but this requires that all directories be loaded into a dict. Calling hasdir() instead puts the work on the the manifest to check for the existence of a directory in the most efficient manner.
author Drew Gottlieb <drgott@google.com>
date Fri, 13 Mar 2015 15:36:11 -0700
parents 79d9c51488ca
children 5da0eb641881
comparison
equal deleted inserted replaced
24325:79d9c51488ca 24326:637da5711122
605 # specified pattern is the exact name 605 # specified pattern is the exact name
606 fset.remove(fn) 606 fset.remove(fn)
607 if match(fn): 607 if match(fn):
608 yield fn 608 yield fn
609 for fn in sorted(fset): 609 for fn in sorted(fset):
610 if fn in self._dirs: 610 if not self.hasdir(fn):
611 # specified pattern is a directory 611 match.bad(fn, _('no such file in rev %s') % self)
612 continue
613 match.bad(fn, _('no such file in rev %s') % self)
614 612
615 def matches(self, match): 613 def matches(self, match):
616 return self.walk(match) 614 return self.walk(match)
617 615
618 class basefilectx(object): 616 class basefilectx(object):
1562 match = superself._matchstatus(other, match) 1560 match = superself._matchstatus(other, match)
1563 if other != self._repo['.']: 1561 if other != self._repo['.']:
1564 def bad(f, msg): 1562 def bad(f, msg):
1565 # 'f' may be a directory pattern from 'match.files()', 1563 # 'f' may be a directory pattern from 'match.files()',
1566 # so 'f not in ctx1' is not enough 1564 # so 'f not in ctx1' is not enough
1567 if f not in other and f not in other.dirs(): 1565 if f not in other and not other.hasdir(f):
1568 self._repo.ui.warn('%s: %s\n' % 1566 self._repo.ui.warn('%s: %s\n' %
1569 (self._repo.dirstate.pathto(f), msg)) 1567 (self._repo.dirstate.pathto(f), msg))
1570 match.bad = bad 1568 match.bad = bad
1571 return match 1569 return match
1572 1570