commit listening requires at least mercurial 3.4

Issue #971 resolved
Sebastian Sebastian
repo owner created an issue

The commits page returns status code 500, if the configured mercurial is older than 3.4.

The problem seems to be located in the cangeset-eager.style. The ifeq close part:

close={ifeq(get(extras, 'close'),1,1,0)}

seams not work before mercurial 3.4. The change was introduced with PR #34.

The commit listing should work for mercurial >= 2.0.

Comments (7)

  1. Gábor Stefanik

    The following works all the way down to Hg 2.4 (same as the pre-PR#39 solution - join() was added in 2.4):

    {join(extras,',')|stringify|urlescape}
    

    This causes characters in the value of the extras field to be urlencoded as necessary, so slightly different decoding is needed ("close=1" encodes as "close%3D1", and the comma used as field separator becomes "%2C").

    Alternatively, this works even in 1.9:

    {extras|stringify|urlescape}
    

    ...but it has the unfortunate side effect of generating a false positive if the extras field contains e.g. "disclose=1234", since {extras|stringify} is equivalent to {join(extras, '')}.

    EDIT: not just "disclose=1234", but also "branch=classic" and "lose=1234" on the same commit

  2. Gábor Stefanik

    OK, pull request #41 submitted with a fix that works down to at least 1.9 (the oldest I can test), but possibly as low as 0.9.2. The only side effect is that the extras field is returned with a trailing comma, so instead of "branch=temp,close=1", it returns "branch=temp,close=1,", which the current parsing code can handle without change.

    (As a side note, the commas aren't currently checked, so disclose=1234 is treated as close=1 regardless of whether or not the list is comma-separated.)

  3. Log in to comment