[PATCH 6 of 8 V2] hgweb: link to diff with linerange in filelog template

Gregory Szorc gregory.szorc at gmail.com
Tue Feb 28 18:28:31 EST 2017


On Sat, Feb 25, 2017 at 1:06 AM, Denis Laxalde <denis at laxalde.org> wrote:

> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1484838729 -3600
> #      Thu Jan 19 16:12:09 2017 +0100
> # Node ID 206b34cf11b768c4e74582ffb89e78feedbce7ef
> # Parent  7fbe70c91d65683ab3984f7c80edc85f5c02860c
> # Available At https://hg.logilab.org/users/dlaxalde/hg
> #              hg pull https://hg.logilab.org/users/dlaxalde/hg -r
> 206b34cf11b7
> # EXP-Topic linerange-log/hgweb-filelog
> hgweb: link to diff with linerange in filelog template
>
> When "linerange" query parameter is present on a filelog request, the
> "diff"
> links in revision table rows will also have this parameter.
>
> Not sure this is that good from a user experience point of view, maybe an
> additional "block diff" link would be better.
>
> (Still only the gitweb template is updated.)
>
> diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/
> map
> --- a/mercurial/templates/gitweb/map
> +++ b/mercurial/templates/gitweb/map
> @@ -293,7 +293,7 @@ filelogentry = '
>      </td>
>      <td class="link">
>        <a href="{url|urlescape}file/{node|short}/{file|urlescape}{
> sessionvars%urlparameter}">file</a> |
> -      <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{
> sessionvars%urlparameter}">diff</a> |
> +      <a href="{url|urlescape}diff/{node|short}/{file|urlescape}{
> sessionvars%urlparameter}{if(linerange, '{if(sessionvars, "&",
> "?")}linerange={linerange}')}">diff</a> |
>

{linerange} needs escaped because ':' is a reserved character in URLs. It
should be encoded as %3A in the HTML.


>        <a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{
> sessionvars%urlparameter}">annotate</a>
>        {rename%filelogrename}
>      </td>
> diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t
> --- a/tests/test-hgweb-filelog.t
> +++ b/tests/test-hgweb-filelog.t
> @@ -726,7 +726,7 @@ before addition - error
>    </td>
>    <td class="link">
>    <a href="/file/46c1a66bd8fc/c?style=gitweb">file</a> |
> -  <a href="/diff/46c1a66bd8fc/c?style=gitweb">diff</a> |
> +  <a href="/diff/46c1a66bd8fc/c?style=gitweb&linerange=1:2">diff</a> |
>    <a href="/annotate/46c1a66bd8fc/c?style=gitweb">annotate</a>
>
>    </td>
> @@ -742,7 +742,7 @@ before addition - error
>    </td>
>    <td class="link">
>    <a href="/file/6563da9dcf87/b?style=gitweb">file</a> |
> -  <a href="/diff/6563da9dcf87/b?style=gitweb">diff</a> |
> +  <a href="/diff/6563da9dcf87/b?style=gitweb&linerange=1:1">diff</a> |
>    <a href="/annotate/6563da9dcf87/b?style=gitweb">annotate</a>
>
>    </td>
> @@ -826,7 +826,7 @@ before addition - error
>    </td>
>    <td class="link">
>    <a href="/file/46c1a66bd8fc/c?revcount=1&style=gitweb">file</a> |
> -  <a href="/diff/46c1a66bd8fc/c?revcount=1&style=gitweb">diff</a> |
> +  <a href="/diff/46c1a66bd8fc/c?revcount=1&style=gitweb&linerange=1:2">diff</a>
> |
>    <a href="/annotate/46c1a66bd8fc/c?revcount=1&style=gitweb">annotate</a>
>
>    </td>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170228/ca7740b0/attachment.html>


More information about the Mercurial-devel mailing list