Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/context.py Wed Apr 10 15:08:26 2013 -0700 +++ b/mercurial/context.py Wed Apr 10 15:08:26 2013 -0700 @@ -374,16 +374,7 @@ @propertycache def _dirs(self): - dirs = set() - for f in self._manifest: - pos = f.rfind('/') - while pos != -1: - f = f[:pos] - if f in dirs: - break # dirs already contains this and above - dirs.add(f) - pos = f.rfind('/') - return dirs + return scmutil.dirs(self._manifest) def dirs(self): return self._dirs @@ -1155,7 +1146,7 @@ self._repo.dirstate.setparents(node) def dirs(self): - return set(self._repo.dirstate.dirs()) + return self._repo.dirstate.dirs() class workingfilectx(filectx): """A workingfilectx object makes access to data related to a particular