comparison mercurial/context.py @ 18899:d8ff607ef721

scmutil: use new dirs class in dirstate and context The multiset-of-directories code was open coded in each of these modules; this change gets rid of the duplication.
author Bryan O'Sullivan <bryano@fb.com>
date Wed, 10 Apr 2013 15:08:26 -0700
parents f02045645d12
children c3b920980f22
comparison
equal deleted inserted replaced
18898:856960173630 18899:d8ff607ef721
372 return patch.diff(self._repo, ctx2.node(), self.node(), 372 return patch.diff(self._repo, ctx2.node(), self.node(),
373 match=match, opts=diffopts) 373 match=match, opts=diffopts)
374 374
375 @propertycache 375 @propertycache
376 def _dirs(self): 376 def _dirs(self):
377 dirs = set() 377 return scmutil.dirs(self._manifest)
378 for f in self._manifest:
379 pos = f.rfind('/')
380 while pos != -1:
381 f = f[:pos]
382 if f in dirs:
383 break # dirs already contains this and above
384 dirs.add(f)
385 pos = f.rfind('/')
386 return dirs
387 378
388 def dirs(self): 379 def dirs(self):
389 return self._dirs 380 return self._dirs
390 381
391 def dirty(self): 382 def dirty(self):
1153 for f in self.removed(): 1144 for f in self.removed():
1154 self._repo.dirstate.drop(f) 1145 self._repo.dirstate.drop(f)
1155 self._repo.dirstate.setparents(node) 1146 self._repo.dirstate.setparents(node)
1156 1147
1157 def dirs(self): 1148 def dirs(self):
1158 return set(self._repo.dirstate.dirs()) 1149 return self._repo.dirstate.dirs()
1159 1150
1160 class workingfilectx(filectx): 1151 class workingfilectx(filectx):
1161 """A workingfilectx object makes access to data related to a particular 1152 """A workingfilectx object makes access to data related to a particular
1162 file in the working directory convenient.""" 1153 file in the working directory convenient."""
1163 def __init__(self, repo, path, filelog=None, workingctx=None): 1154 def __init__(self, repo, path, filelog=None, workingctx=None):