[PATCH] remove: use ctx.hasdir(f) instead of 'f in ctx.dirs()'

Martin von Zweigbergk martinvonz at google.com
Tue May 5 23:08:16 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1429633799 25200
#      Tue Apr 21 09:29:59 2015 -0700
# Node ID 55d4b9553bef160e031f1249ab9d0ec01cdadc3c
# Parent  c5d4f9cc8da7bb2068457e96e4f74ff694514ced
remove: use ctx.hasdir(f) instead of 'f in ctx.dirs()'

This speeds up 'hg remove python/README' on the Firefox repo from
2.479s to 0.664s with lazily loaded treemanifests (which is not yet in
core) and has no measurable effect on flat manifests.

diff -r c5d4f9cc8da7 -r 55d4b9553bef mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Tue May 05 12:33:26 2015 -0500
+++ b/mercurial/cmdutil.py	Tue Apr 21 09:29:59 2015 -0700
@@ -2336,7 +2336,7 @@
                     return True
             return False
 
-        isdir = f in deleteddirs or f in wctx.dirs()
+        isdir = f in deleteddirs or wctx.hasdir(f)
         if f in repo.dirstate or isdir or f == '.' or insubrepo():
             continue
 


More information about the Mercurial-devel mailing list