Patchwork hgweb: show users recorded in obsolescence markers

login
register
mail settings
Submitter Anton Shestakov
Date Feb. 14, 2018, 1:41 p.m.
Message ID <7c6900cc30ee801b7820.1518615661@neuro>
Download mbox | patch
Permalink /patch/27912/
State Accepted
Headers show

Comments

Anton Shestakov - Feb. 14, 2018, 1:41 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1518611552 -28800
#      Wed Feb 14 20:32:32 2018 +0800
# Node ID 7c6900cc30ee801b782086d98fdcea878eba2bab
# Parent  c64b9adfb371b6e9dfd2257d3e2f62d5121341df
hgweb: show users recorded in obsolescence markers

It's useful to see who obsoleted a commit, because it's not always done by its
author (hg-committed is a good example, because people rebase stacks of commits
made by various people).

Usernames are obfuscated, but look correct (e.g. "&#116;&#101;&#115;&#116;" is
"test").
Gregory Szorc - Feb. 14, 2018, 10:29 p.m.
On Wed, Feb 14, 2018 at 5:41 AM, Anton Shestakov <av6@dwimlabs.net> wrote:

> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1518611552 -28800
> #      Wed Feb 14 20:32:32 2018 +0800
> # Node ID 7c6900cc30ee801b782086d98fdcea878eba2bab
> # Parent  c64b9adfb371b6e9dfd2257d3e2f62d5121341df
> hgweb: show users recorded in obsolescence markers
>

Queued, thanks.

FWIW, I'm skeptical that obfuscating via entity codes really matters, as
any reasonable web scraper will decode those entities into their string
value. But if scrapers are still dumb, then I stand corrected.


>
> It's useful to see who obsoleted a commit, because it's not always done by
> its
> author (hg-committed is a good example, because people rebase stacks of
> commits
> made by various people).
>
> Usernames are obfuscated, but look correct (e.g.
> "&#116;&#101;&#115;&#116;" is
> "test").
>
> diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/
> map
> --- a/mercurial/templates/gitweb/map
> +++ b/mercurial/templates/gitweb/map
> @@ -275,7 +275,8 @@ successorlink = '<a class="list" href="{
>  obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
>  obsfateverb = '{obsfateverb(successors, markers)}'
>  obsfateoperations = '{if(obsfateoperations(markers), ' using
> {join(obsfateoperations(markers), ', ')}')}'
> -obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
> +obsfateusers = '{if(obsfateusers(markers), ' by
> {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
> +obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{
> obsfateusers}'
>  shortlogentry = '
>    <tr class="parity{parity}">
>      <td class="age"><i class="age">{date|rfc822date}</i></td>
> diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/
> monoblue/map
> --- a/mercurial/templates/monoblue/map
> +++ b/mercurial/templates/monoblue/map
> @@ -233,7 +233,8 @@ successorlink = '<a href="{url|urlescape
>  obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
>  obsfateverb = '{obsfateverb(successors, markers)}'
>  obsfateoperations = '{if(obsfateoperations(markers), ' using
> {join(obsfateoperations(markers), ', ')}')}'
> -obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
> +obsfateusers = '{if(obsfateusers(markers), ' by
> {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
> +obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{
> obsfateusers}'
>  shortlogentry = '
>    <tr class="parity{parity}">
>      <td class="nowrap age">{date|rfc822date}</td>
> diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
> --- a/mercurial/templates/paper/map
> +++ b/mercurial/templates/paper/map
> @@ -213,7 +213,8 @@ successorlink = '<a href="{url|urlescape
>  obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
>  obsfateverb = '{obsfateverb(successors, markers)}'
>  obsfateoperations = '{if(obsfateoperations(markers), ' using
> {join(obsfateoperations(markers), ', ')}')}'
> -obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
> +obsfateusers = '{if(obsfateusers(markers), ' by
> {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
> +obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{
> obsfateusers}'
>
>  filediffparent = '
>    <tr>
> diff --git a/mercurial/templates/spartan/map
> b/mercurial/templates/spartan/map
> --- a/mercurial/templates/spartan/map
> +++ b/mercurial/templates/spartan/map
> @@ -170,7 +170,8 @@ successorlink = '<a href="{url|urlescape
>  obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
>  obsfateverb = '{obsfateverb(successors, markers)}'
>  obsfateoperations = '{if(obsfateoperations(markers), ' using
> {join(obsfateoperations(markers), ', ')}')}'
> -obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
> +obsfateusers = '{if(obsfateusers(markers), ' by
> {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
> +obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{
> obsfateusers}'
>  filediffparent = '
>    <tr>
>      <th class="parent">parent {rev}:</th>
> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -1050,19 +1050,19 @@ check obsolete changeset
>            <span class="logtags"><span class="phasetag"
> title="draft">draft</span> <span class="obsoletetag"
> title="obsolete">obsolete</span> </span>
>    $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=spartan'
> | grep 'class="obsolete"'
>      <th class="obsolete">obsolete:</th>
> -    <td class="obsolete">pruned</td>
> +    <td class="obsolete">pruned by &#116;&#101;&#115;&#116;</td>
>
>  check an obsolete changeset that has been rewritten
>    $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=paper'
> | grep rewritten
> -   <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a>
> </td>
> +   <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a>
> by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#
> 64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#
> 101;&#116;&#62;</td>
>    $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=coal' |
> grep rewritten
> -   <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a>
> </td>
> +   <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a>
> by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#
> 64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#
> 101;&#116;&#62;</td>
>    $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=gitweb'
> | grep rewritten
> -  <tr><td>obsolete</td><td>rewritten as <a class="list"
> href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a> </td></tr>
> +  <tr><td>obsolete</td><td>rewritten as <a class="list"
> href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a>  by
> &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#
> 64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#
> 101;&#116;&#62;</td></tr>
>    $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=monoblue'
> | grep rewritten
> -          <dt>obsolete</dt><dd>rewritten as <a
> href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a> </dd>
> +          <dt>obsolete</dt><dd>rewritten as <a
> href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a>  by
> &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#
> 64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#
> 101;&#116;&#62;</dd>
>    $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=spartan'
> | grep rewritten
> -   <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a>
> </td>
> +   <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a>
> by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#
> 64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#
> 101;&#116;&#62;</td>
>
>  check changeset with instabilities
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -275,7 +275,8 @@  successorlink = '<a class="list" href="{
 obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
 obsfateverb = '{obsfateverb(successors, markers)}'
 obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
+obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="age"><i class="age">{date|rfc822date}</i></td>
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -233,7 +233,8 @@  successorlink = '<a href="{url|urlescape
 obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
 obsfateverb = '{obsfateverb(successors, markers)}'
 obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
+obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="nowrap age">{date|rfc822date}</td>
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -213,7 +213,8 @@  successorlink = '<a href="{url|urlescape
 obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
 obsfateverb = '{obsfateverb(successors, markers)}'
 obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
+obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
 
 filediffparent = '
   <tr>
diff --git a/mercurial/templates/spartan/map b/mercurial/templates/spartan/map
--- a/mercurial/templates/spartan/map
+++ b/mercurial/templates/spartan/map
@@ -170,7 +170,8 @@  successorlink = '<a href="{url|urlescape
 obsfatesuccessors = '{if(successors, ' as ')}{successors%successorlink}'
 obsfateverb = '{obsfateverb(successors, markers)}'
 obsfateoperations = '{if(obsfateoperations(markers), ' using {join(obsfateoperations(markers), ', ')}')}'
-obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}'
+obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}'
+obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}'
 filediffparent = '
   <tr>
     <th class="parent">parent {rev}:</th>
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1050,19 +1050,19 @@  check obsolete changeset
           <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="obsoletetag" title="obsolete">obsolete</span> </span>
   $ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=spartan' | grep 'class="obsolete"'
     <th class="obsolete">obsolete:</th>
-    <td class="obsolete">pruned</td>
+    <td class="obsolete">pruned by &#116;&#101;&#115;&#116;</td>
 
 check an obsolete changeset that has been rewritten
   $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=paper' | grep rewritten
-   <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a> </td>
+   <td>rewritten as <a href="/rev/3de5eca88c00?style=paper">3de5eca88c00</a>  by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#101;&#116;&#62;</td>
   $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=coal' | grep rewritten
-   <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a> </td>
+   <td>rewritten as <a href="/rev/3de5eca88c00?style=coal">3de5eca88c00</a>  by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#101;&#116;&#62;</td>
   $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=gitweb' | grep rewritten
-  <tr><td>obsolete</td><td>rewritten as <a class="list" href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a> </td></tr>
+  <tr><td>obsolete</td><td>rewritten as <a class="list" href="/rev/3de5eca88c00?style=gitweb">3de5eca88c00</a>  by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#101;&#116;&#62;</td></tr>
   $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=monoblue' | grep rewritten
-          <dt>obsolete</dt><dd>rewritten as <a href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a> </dd>
+          <dt>obsolete</dt><dd>rewritten as <a href="/rev/3de5eca88c00?style=monoblue">3de5eca88c00</a>  by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#101;&#116;&#62;</dd>
   $ get-with-headers.py localhost:$HGPORT 'rev/cda648ca50f5?style=spartan' | grep rewritten
-   <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a> </td>
+   <td class="obsolete">rewritten as <a href="/rev/3de5eca88c00?style=spartan">3de5eca88c00</a>  by &#116;&#101;&#115;&#116;&#32;&#60;&#116;&#101;&#115;&#116;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#110;&#101;&#116;&#62;</td>
 
 check changeset with instabilities