Comments
Patch
@@ -264,12 +264,11 @@
diffopts = patch.diffopts(self._repo.ui, opts)
return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts)
- @propertycache
- def _dirs(self):
- return scmutil.dirs(self._manifest)
+ def dirs(self):
+ return self._manifest.dirs()
- def dirs(self):
- return self._dirs
+ def hasdir(self, dir):
+ return self._manifest.hasdir(dir)
def dirty(self, missing=False, merge=True, branch=True):
return False
@@ -606,10 +605,8 @@
if match(fn):
yield fn
for fn in sorted(fset):
- if fn in self._dirs:
- # specified pattern is a directory
- continue
- match.bad(fn, _('no such file in rev %s') % self)
+ if not self.hasdir(fn):
+ match.bad(fn, _('no such file in rev %s') % self)
def matches(self, match):
return self.walk(match)
@@ -1559,7 +1556,7 @@
def bad(f, msg):
# 'f' may be a directory pattern from 'match.files()',
# so 'f not in ctx1' is not enough
- if f not in other and f not in other.dirs():
+ if f not in other and not other.hasdir(f):
self._repo.ui.warn('%s: %s\n' %
(self._repo.dirstate.pathto(f), msg))
match.bad = bad
@@ -6,9 +6,10 @@
# GNU General Public License version 2 or any later version.
from i18n import _
-import mdiff, parsers, error, revlog, util
+import mdiff, parsers, error, revlog, util, scmutil
import array, struct
+propertycache = util.propertycache
class _lazymanifest(dict):
"""This is the pure implementation of lazymanifest.
@@ -141,6 +142,16 @@
files.difference_update(m2.iterkeys())
return files
+ @propertycache
+ def _dirs(self):
+ return scmutil.dirs(self)
+
+ def dirs(self):
+ return self._dirs
+
+ def hasdir(self, dir):
+ return dir in self._dirs
+
def matches(self, match):
'''generate a new manifest filtered by the match argument'''
if match.always():