[PATCH] graphlog: hide internal state of ascii() from users

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Sun Oct 4 19:23:54 UTC 2009


On Fri, Oct 2, 2009 at 8:38 PM, Dennis Brakhane <brakhane at googlemail.com> wrote:
> On Fri, Oct 2, 2009 at 10:00 AM, Peter Arrenbrecht
> <peter.arrenbrecht at gmail.com> wrote:
>>  def generate(ui, dag, displayer, showparents, edgefn):
>> -    seen, base = [], [0, 0]
>> +    seen, ctx = [], asciictx()
>>     for rev, type, ctx, parents in dag:
>>         char = ctx.node() in showparents and '@' or 'o'
>>         displayer.show(ctx)
>>         lines = displayer.hunk.pop(rev).split('\n')[:-1]
>> -        ascii(ui, base, type, char, lines, edgefn(seen, rev, parents))
>> +        ascii(ui, ctx, type, char, lines, edgefn(seen, rev, parents))
>
> Am I missing something? To me it looks like ctx is identical to
> dag[x][2]. If this
> works, isn't the entire initialization unnecessary?

I do not understand. The list returned by asciictx() is used by
ascii() to track internal state across invocations.
-parren




More information about the Mercurial-devel mailing list