status: avoid recursing into ignored directory with "--terse u"
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 24 Jul 2017 10:34:32 +0200
changeset 33694 93422d0068f8
parent 33693 db3dc11356ed
child 33695 eeed23508383
status: avoid recursing into ignored directory with "--terse u" Let "isignoreddir" function first check that supplied directory is itself ignored before walking recursively into its content. Otherwise, the command is awfully slow when one has an ignored directory with a lot of content. Update and rephrase function docstring accordingly.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon Jul 31 09:59:42 2017 +0530
+++ b/mercurial/cmdutil.py	Mon Jul 24 10:34:32 2017 +0200
@@ -466,12 +466,12 @@
         return True
 
     def isignoreddir(localpath):
-        """
-        This function checks whether the directory contains only ignored files
-        and hence should the directory be considered ignored. Returns True, if
-        that should be ignored otherwise False.
+        """Return True if `localpath` directory is ignored or contains only
+        ignored files and should hence be considered ignored.
         """
         dirpath = os.path.join(root, localpath)
+        if ignorefn(dirpath):
+            return True
         for f in os.listdir(dirpath):
             filepath = os.path.join(dirpath, f)
             if os.path.isdir(filepath):