[PATCH 2 of 4 evolve-ext] evolve: add ordering of the revisions for evolve --rev

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 3 15:37:04 CDT 2015

On 06/03/2015 01:33 PM, Laurent Charignon wrote:
>> On Jun 3, 2015, at 1:04 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>> On 06/02/2015 04:01 PM, Laurent Charignon wrote:
>>> +    while lively and len(ordering) != len(revs):
>>> +        # We don't want to go overboard in infinite loop
>>> +        assert(len(ordering) < len(revs))
>> Why don't you put the < in the while conditional?
> Because, let's say that we end up with len(ordering) > len(revs) it would stop the conditional and we would still have to fail after with an error, it saves a line

You should not expect assert to run in production code, so with your 
current code, you can still loop forever if you code is buggy. If you 
think this might happen, make it an explicite condition in the while 
loop. (and as a general principle, stay on the safe side in your while 

Pierre-Yves David

More information about the Mercurial-devel mailing list