workingctx: use normal dirs() instead of dirstate.dirs()
authorDurham Goode <durham@fb.com>
Thu, 05 Mar 2015 22:16:28 -0800
changeset 24213 e0c1328df872
parent 24212 4ef4e3c3c006
child 24214 a5f1bccd2996
workingctx: use normal dirs() instead of dirstate.dirs() The workingctx class was using dirstate.dirs() as it's implementation. The sparse extension maintains a pruned down version of the dirstate, so this resulted in the workingctx reporting an incorrect listing of directories during merge calculations (it was detecting directory renames when it shouldn't have). The fix is to use the default implementation, which uses workingctx._manifest, which unions the manifest with the dirstate to produce the correct overall picture. This also produces more accurate output since it will no longer return directories that have been entirely deleted in the dirstate. Tests will be added to the sparse extension to detect regressions for this.
mercurial/cmdutil.py
mercurial/context.py
--- a/mercurial/cmdutil.py	Thu Mar 05 15:52:07 2015 -0600
+++ b/mercurial/cmdutil.py	Thu Mar 05 22:16:28 2015 -0800
@@ -2071,6 +2071,7 @@
                                % join(subpath))
 
     # warn about failure to delete explicit files/dirs
+    deleteddirs = scmutil.dirs(deleted)
     for f in m.files():
         def insubrepo():
             for subpath in wctx.substate:
@@ -2078,7 +2079,8 @@
                     return True
             return False
 
-        if f in repo.dirstate or f in wctx.dirs() or f == '.' or insubrepo():
+        isdir = f in deleteddirs or f in wctx.dirs()
+        if f in repo.dirstate or isdir or f == '.' or insubrepo():
             continue
 
         if repo.wvfs.exists(f):
--- a/mercurial/context.py	Thu Mar 05 15:52:07 2015 -0600
+++ b/mercurial/context.py	Thu Mar 05 22:16:28 2015 -0800
@@ -1289,9 +1289,6 @@
         self._repo.dirstate.setparents(node)
         self._repo.dirstate.endparentchange()
 
-    def dirs(self):
-        return self._repo.dirstate.dirs()
-
 class workingctx(committablectx):
     """A workingctx object makes access to data related to
     the current working directory convenient.