[PATCH 4 of 4] hgweb: add a link to followlines in descending direction
Gregory Szorc
gregory.szorc at gmail.com
Sat Apr 15 20:11:57 UTC 2017
On Tue, Apr 11, 2017 at 6:09 AM, Denis Laxalde <denis at laxalde.org> wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde at logilab.fr>
> # Date 1491838600 -7200
> # Mon Apr 10 17:36:40 2017 +0200
> # Node ID 4895e777df5cc64eccd038d71a9f9a5b969a5ea0
> # Parent a24bf350ea723273831d6531a1345ed458312126
> # Available At http://hg.logilab.org/users/dlaxalde/hg
> # hg pull http://hg.logilab.org/users/dlaxalde/hg -r
> 4895e777df5c
> hgweb: add a link to followlines in descending direction
>
> We change the content of the followlines popup to display two links
> inviting
> to follow the history of selected lines in ascending (as before) and
> descending directions. The popup now renders as:
>
> follow history of lines <fromline>:<toline>:
> <a href=...>ascending</a> / <a href=...>descending</a>
>
How difficult would it be to not render the "descending" link when we're
already looking at the latest changeset / file revision? As it is today,
the "descending" link goes to a blank page.
>
> diff --git a/mercurial/templates/static/followlines.js
> b/mercurial/templates/static/followlines.js
> --- a/mercurial/templates/static/followlines.js
> +++ b/mercurial/templates/static/followlines.js
> @@ -204,13 +204,23 @@ document.addEventListener('DOMContentLoa
> // <div class="followlines-link">
> var aDiv = document.createElement('div');
> aDiv.classList.add('followlines-link');
> -
> - // <a href="/log/<rev>/<file>?patch=&linerange=...">
> - var a = document.createElement('a');
> + aDiv.textContent = 'follow history of lines ' + fromline + ':' +
> toline + ':';
> + var linesep = document.createElement('br');
> + aDiv.appendChild(linesep);
> + // link to "ascending" followlines
> + var aAsc = document.createElement('a');
> var url = targetUri + '?patch=&linerange=' + fromline + ':' +
> toline;
> - a.setAttribute('href', url);
> - a.textContent = 'follow lines ' + fromline + ':' + toline;
> - aDiv.appendChild(a);
> + aAsc.setAttribute('href', url);
> + aAsc.textContent = 'ascending';
> + aDiv.appendChild(aAsc);
> + var sep = document.createTextNode(' / ');
> + aDiv.appendChild(sep);
> + // link to "descending" followlines
> + var aDesc = document.createElement('a');
> + aDesc.setAttribute('href', url + '&descend=');
> + aDesc.textContent = 'descending';
> + aDiv.appendChild(aDesc);
> +
> div.appendChild(aDiv);
>
> return [div, button];
> _______________________________________________
> 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://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170415/7674d01b/attachment-0002.html>
More information about the Mercurial-devel
mailing list