[PATCH] phases: implement ``phase()`` and ``hidden()`` method for workingctx

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 21 16:37:26 CST 2011


On 21 déc. 2011, at 22:33, Matt Mackall wrote:

> On Tue, 2011-12-20 at 12:37 +0100, pierre-yves.david at logilab.fr wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
>> # Date 1324380288 -3600
>> # Node ID ffcda6c337f47e06a4b688613cb810366a7635c6
>> # Parent  9d62a0e54cdb861635fe29db437a8a5a5e8e0180
>> phases: implement ``phase()`` and ``hidden()`` method for workingctx
>> 
>> default changectx crash while trying to index a list with None.
> 
> What does this comment have to do with your patch??

We need a specific implementation for workingctx because the default
changectx code doesn't work. The fact we need a specific implementation
Is probably obvious enough not to explain why. You can ignore this line.

> 
>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -801,10 +801,19 @@ class workingctx(changectx):
>>         b = []
>>         for p in self.parents():
>>             b.extend(p.bookmarks())
>>         return b
>> 
>> +    def phase(self):
>> +        phase = 1 # default phase to draft
>> +        for p in self.parents():
>> +            phase = max(phase, p.phase())
>> +        return phase
>> +
>> +    def hidden(self):
>> +        return False
>> +
>>     def children(self):
>>         return []
>> 
>>     def flags(self, path):
>>         if '_manifest' in self.__dict__:
> 
> 
> -- 
> Mathematics is the supreme nostalgia of our time.
> 
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list