Patchwork [02,of,19] basectx: add _manifestmatches method that is a duplicate of mfmatches

login
register
mail settings
Submitter Sean Farley
Date May 15, 2014, 9:16 p.m.
Message ID <4f3d70781a6031841ed1.1400188580@laptop.local>
Download mbox | patch
Permalink /patch/4762/
State Accepted
Commit 3b1ec3d4ece69da45d3a30235fa9f072b73d3cd9
Headers show

Comments

Sean Farley - May 15, 2014, 9:16 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1398304330 18000
#      Wed Apr 23 20:52:10 2014 -0500
# Node ID 4f3d70781a6031841ed191b360b7971af948977f
# Parent  ac2d57df1c2160e6da43d112b9eadfe688415472
basectx: add _manifestmatches method that is a duplicate of mfmatches
Pierre-Yves David - May 15, 2014, 10:27 p.m.
On 05/15/2014 02:16 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley<sean.michael.farley@gmail.com>
> # Date 1398304330 18000
> #      Wed Apr 23 20:52:10 2014 -0500
> # Node ID 4f3d70781a6031841ed191b360b7971af948977f
> # Parent  ac2d57df1c2160e6da43d112b9eadfe688415472
> basectx: add _manifestmatches method that is a duplicate of mfmatches

Whats is `mfmatches`?

Something along the line of:

   basectx: add _manifestmatches method

   This methods is a duplicate that is a duplicate
   of localrepo.mfmatches.

Would be much clearer.

> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -61,10 +61,19 @@ class basectx(object):
>
>       def __iter__(self):
>           for f in sorted(self._manifest):
>               yield f
>
> +    def _manifestmatches(self, match, s):

This methods wants a docstring.
Sean Farley - May 16, 2014, 1:14 a.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 05/15/2014 02:16 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley<sean.michael.farley@gmail.com>
>> # Date 1398304330 18000
>> #      Wed Apr 23 20:52:10 2014 -0500
>> # Node ID 4f3d70781a6031841ed191b360b7971af948977f
>> # Parent  ac2d57df1c2160e6da43d112b9eadfe688415472
>> basectx: add _manifestmatches method that is a duplicate of mfmatches
>
> Whats is `mfmatches`?
>
> Something along the line of:
>
>    basectx: add _manifestmatches method
>
>    This methods is a duplicate that is a duplicate
>    of localrepo.mfmatches.
>
> Would be much clearer.

Ok, sounds good.

>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -61,10 +61,19 @@ class basectx(object):
>>
>>       def __iter__(self):
>>           for f in sorted(self._manifest):
>>               yield f
>>
>> +    def _manifestmatches(self, match, s):
>
> This methods wants a docstring.

Sure.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -61,10 +61,19 @@  class basectx(object):
 
     def __iter__(self):
         for f in sorted(self._manifest):
             yield f
 
+    def _manifestmatches(self, match, s):
+        mf = self.manifest().copy()
+        if match.always():
+            return mf
+        for fn in mf.keys():
+            if not match(fn):
+                del mf[fn]
+        return mf
+
     @propertycache
     def substate(self):
         return subrepo.state(self, self._repo.ui)
 
     def rev(self):