[PATCH STABLE] status: avoid recursing into ignored directory with "--terse u"

Denis Laxalde denis at laxalde.org
Tue Jul 25 07:25:15 EDT 2017


Augie Fackler a écrit :
> On Mon, Jul 24, 2017 at 11:05:21AM +0200, Denis Laxalde wrote:
>> # HG changeset patch
>> # User Denis Laxalde <denis.laxalde at logilab.fr>
>> # Date 1500885272 -7200
>> #      Mon Jul 24 10:34:32 2017 +0200
>> # Branch stable
>> # Node ID 55539b4f598f54115e82d47dadefce8feebd465f
>> # Parent  e9850cc580a758f06506276140cc424bc8a415be
>> # Available At http://hg.logilab.org/users/dlaxalde/hg
>> #              hg pull http://hg.logilab.org/users/dlaxalde/hg -r 55539b4f598f
>> status: avoid recursing into ignored directory with "--terse u"
>
> I'm really really enthusiastic about this. But it's enough of a "new
> feature" that I'm wary of landing it during the freeze. I've queued it
> for default, but that means it won't show up anywhere until we finish
> the 4.3 release. Let me know if I should discard it and expect a
> resend instead.

Ok, that's fine.
Anyways, I guess that, beyond this patch, the code would need other
performance-related tweaks.

>>
>> 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.
>>
>> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
>> --- a/mercurial/cmdutil.py
>> +++ b/mercurial/cmdutil.py
>> @@ -466,12 +466,12 @@ def tersestatus(root, statlist, status,
>>          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):
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list