Patchwork [09,of,19] context: add a no-op _prestatus method

login
register
mail settings
Submitter Sean Farley
Date May 15, 2014, 9:16 p.m.
Message ID <232598babb1191bceaa3.1400188587@laptop.local>
Download mbox | patch
Permalink /patch/4768/
State Accepted
Commit ef9b2bea970924bbfdb253c8bbd708feb26c617d
Headers show

Comments

Sean Farley - May 15, 2014, 9:16 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1398134350 18000
#      Mon Apr 21 21:39:10 2014 -0500
# Node ID 232598babb1191bceaa31f13d860568c795352bf
# Parent  a689734f58d9cf710c0ac21243d69e652d40377a
context: add a no-op _prestatus method
Pierre-Yves David - May 15, 2014, 11:42 p.m.
On 05/15/2014 02:16 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1398134350 18000
> #      Mon Apr 21 21:39:10 2014 -0500
> # Node ID 232598babb1191bceaa31f13d860568c795352bf
> # Parent  a689734f58d9cf710c0ac21243d69e652d40377a
> context: add a no-op _prestatus method

You need to explains the "why" of this change a bit more


>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -70,10 +70,13 @@ class basectx(object):
>           for fn in mf.keys():
>               if not match(fn):
>                   del mf[fn]
>           return mf
>
> +    def _prestatus(self, other, s, match, listignored, listclean, listunknown):

and a docstring here.

> +        return s
> +
>       def _generatestatus(self, other, s, match, listignored, listclean,
>                           listunknown):
>           """generate a status with respect to another context"""
>           mf1 = other._manifestmatches(match, s)
>           mf2 = self._manifestmatches(match, s)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Sean Farley - May 16, 2014, 12:35 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 1398134350 18000
>> #      Mon Apr 21 21:39:10 2014 -0500
>> # Node ID 232598babb1191bceaa31f13d860568c795352bf
>> # Parent  a689734f58d9cf710c0ac21243d69e652d40377a
>> context: add a no-op _prestatus method
>
> You need to explains the "why" of this change a bit more

Ok, it will be something like this:

"This patch adds a private _prestatus method so that certain contexts,
such as workingctx, can add custom pre-processing to status."

Later on we need to decide what to do with workingctx.status(memctx)
because currently we will end up here:

r = [[], [], [], [], [], [], []]
match = ctx2._matchstatus(ctx1, r, match, ...)
r = ctx2._prestatus(ctx1, r, match, ...)
r = ctx2._generatestatus(ctx1, r, match, ...)
r = ctx2._poststatus(ctx1, r, match, ...)

This works perfectly well for workingctx with changectx but is maybe too
fragile for memctx. Should we be calling it like this:

r = ctx1._prestatus(ctx1, r, match, ...)
r = ctx2._prestatus(ctx2, r, match, ...)

?

>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -70,10 +70,13 @@ class basectx(object):
>>           for fn in mf.keys():
>>               if not match(fn):
>>                   del mf[fn]
>>           return mf
>>
>> +    def _prestatus(self, other, s, match, listignored, listclean, listunknown):
>
> and a docstring here.

Sure, will do.
Pierre-Yves David - May 16, 2014, 3:53 a.m.
On 05/15/2014 05:35 PM, Sean Farley wrote:
> Later on we need to decide what to do with workingctx.status(memctx)
> because currently we will end up here:
>
> r = [[], [], [], [], [], [], []]
> match = ctx2._matchstatus(ctx1, r, match, ...)
> r = ctx2._prestatus(ctx1, r, match, ...)
> r = ctx2._generatestatus(ctx1, r, match, ...)
> r = ctx2._poststatus(ctx1, r, match, ...)
>
> This works perfectly well for workingctx with changectx but is maybe too
> fragile for memctx. Should we be calling it like this:
>
> r = ctx1._prestatus(ctx1, r, match, ...)
> r = ctx2._prestatus(ctx2, r, match, ...)
>
> ?

Later is later, lets move on the current series.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -70,10 +70,13 @@  class basectx(object):
         for fn in mf.keys():
             if not match(fn):
                 del mf[fn]
         return mf
 
+    def _prestatus(self, other, s, match, listignored, listclean, listunknown):
+        return s
+
     def _generatestatus(self, other, s, match, listignored, listclean,
                         listunknown):
         """generate a status with respect to another context"""
         mf1 = other._manifestmatches(match, s)
         mf2 = self._manifestmatches(match, s)