[PATCH 2 of 2] monoblue: provide links to branches, tags and bookmarks by name

Augie Fackler raf at durin42.com
Mon Sep 28 08:27:41 CDT 2015


On Mon, Sep 28, 2015 at 07:13:08PM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6 at dwimlabs.net>
> # Date 1443259452 -28800
> #      Sat Sep 26 17:24:12 2015 +0800
> # Node ID 97af9cbe1a52b41eab732673be15d11c55385ed8
> # Parent  69a7b236fc96cb1037d7a7e6c4d46efa18be0b0f
> monoblue: provide links to branches, tags and bookmarks by name

Queued this, many thanks.

>
> This is adapted from cd842821db2c, that was added to paper for 3.5 release.
>
> It adds another way to refer to branches, tags and bookmarks in urls: by name.
> It's still possible to navigate to a specific changeset hash, but now you can
> get more descriptive urls straight from /summary page, for example.
>
> branchentry template (and so the whole branches table on /summary and
> /branches) lost the column that had a plain changeset hash, because tags and
> bookmarks don't have this column and also because there is already a way to
> address branch by its changeset hash (changeset link just next to it). Maybe we
> can instead bring this column with a plain changeset hash to tags and
> bookmarks, but this, more terse, new look feels fine.
>
> diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
> --- a/mercurial/templates/monoblue/map
> +++ b/mercurial/templates/monoblue/map
> @@ -173,7 +173,7 @@ tags = tags.tmpl
>  tagentry = '
>    <tr class="parity{parity}">
>      <td class="nowrap age">{date|rfc822date}</td>
> -    <td><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td>
> +    <td><a href="{url|urlescape}rev/{tag|revescape}{sessionvars%urlparameter}">{tag|escape}</a></td>
>      <td class="nowrap">
>        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
>        <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> |
> @@ -184,7 +184,7 @@ bookmarks = bookmarks.tmpl
>  bookmarkentry = '
>    <tr class="parity{parity}">
>      <td class="nowrap age">{date|rfc822date}</td>
> -    <td><a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{bookmark|escape}</a></td>
> +    <td><a href="{url|urlescape}rev/{bookmark|revescape}{sessionvars%urlparameter}">{bookmark|escape}</a></td>
>      <td class="nowrap">
>        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
>        <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> |
> @@ -195,8 +195,7 @@ branches = branches.tmpl
>  branchentry = '
>    <tr class="parity{parity}">
>      <td class="nowrap age">{date|rfc822date}</td>
> -    <td><a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{node|short}</a></td>
> -    <td class="{status}">{branch|escape}</td>
> +    <td class="{status}"><a href="{url|urlescape}shortlog/{branch|revescape}{sessionvars%urlparameter}">{branch|escape}</a></td>
>      <td class="nowrap">
>        <a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
>        <a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">changelog</a> |
> diff --git a/tests/test-hgweb-symrev.t b/tests/test-hgweb-symrev.t
> --- a/tests/test-hgweb-symrev.t
> +++ b/tests/test-hgweb-symrev.t
> @@ -649,11 +649,11 @@ Set up the repo
>    <a href="/rev/43c799df6e75?style=monoblue">
>    <a href="/rev/43c799df6e75?style=monoblue">changeset</a> |
>    <a href="/file/43c799df6e75?style=monoblue">files</a>
> -  <td><a href="/rev/a7c1559b7bba?style=monoblue">xyzzy</a></td>
> +  <td><a href="/rev/xyzzy?style=monoblue">xyzzy</a></td>
>    <a href="/rev/a7c1559b7bba?style=monoblue">changeset</a> |
>    <a href="/log/a7c1559b7bba?style=monoblue">changelog</a> |
>    <a href="/file/a7c1559b7bba?style=monoblue">files</a>
> -  <td><a href="/shortlog/9d8c40cba617?style=monoblue">9d8c40cba617</a></td>
> +  <td class="open"><a href="/shortlog/default?style=monoblue">default</a></td>
>    <a href="/rev/9d8c40cba617?style=monoblue">changeset</a> |
>    <a href="/log/9d8c40cba617?style=monoblue">changelog</a> |
>    <a href="/file/9d8c40cba617?style=monoblue">files</a>
> @@ -689,19 +689,19 @@ Set up the repo
>            | <a href="/graph/43c799df6e75?style=monoblue">(0)</a> <a href="/graph/tip?style=monoblue">tip</a>
>
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'tags?style=monoblue' | egrep $REVLINKS
> -  <td><a href="/rev/9d8c40cba617?style=monoblue">tip</a></td>
> +  <td><a href="/rev/tip?style=monoblue">tip</a></td>
>    <a href="/rev/9d8c40cba617?style=monoblue">changeset</a> |
>    <a href="/log/9d8c40cba617?style=monoblue">changelog</a> |
>    <a href="/file/9d8c40cba617?style=monoblue">files</a>
>
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'bookmarks?style=monoblue' | egrep $REVLINKS
> -  <td><a href="/rev/a7c1559b7bba?style=monoblue">xyzzy</a></td>
> +  <td><a href="/rev/xyzzy?style=monoblue">xyzzy</a></td>
>    <a href="/rev/a7c1559b7bba?style=monoblue">changeset</a> |
>    <a href="/log/a7c1559b7bba?style=monoblue">changelog</a> |
>    <a href="/file/a7c1559b7bba?style=monoblue">files</a>
>
>    $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'branches?style=monoblue' | egrep $REVLINKS
> -  <td><a href="/shortlog/9d8c40cba617?style=monoblue">9d8c40cba617</a></td>
> +  <td class="open"><a href="/shortlog/default?style=monoblue">default</a></td>
>    <a href="/rev/9d8c40cba617?style=monoblue">changeset</a> |
>    <a href="/log/9d8c40cba617?style=monoblue">changelog</a> |
>    <a href="/file/9d8c40cba617?style=monoblue">files</a>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list