[PATCH 1 of 6] dirstate: rename dirs to iterdirs, and return only dir names

Bryan O'Sullivan bos at serpentine.com
Thu Mar 28 20:22:43 CDT 2013


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1364520135 25200
#      Thu Mar 28 18:22:15 2013 -0700
# Node ID d6bb127c3380f9ee622703d87bae4bc1fd0f8421
# Parent  e9a558d9ee06a72beb8b4168862371596aa45386
dirstate: rename dirs to iterdirs, and return only dir names

The refcounts that we maintain behind the scenes are not public, so make
sure we don't expose them to callers (who don't care anyway).

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1155,7 +1155,7 @@ class workingctx(changectx):
         self._repo.dirstate.setparents(node)
 
     def dirs(self):
-        return set(self._repo.dirstate.dirs())
+        return set(self._repo.dirstate.iterdirs())
 
 class workingfilectx(filectx):
     """A workingfilectx object makes access to data related to a particular
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -119,8 +119,8 @@ class dirstate(object):
                 _incdirs(dirs, f)
         return dirs
 
-    def dirs(self):
-        return self._dirs
+    def iterdirs(self):
+        return self._dirs.iterkeys()
 
     @rootcache('.hgignore')
     def _ignore(self):


More information about the Mercurial-devel mailing list