hgweb: show instabilities of a commit
authorAnton Shestakov <av6@dwimlabs.net>
Sun, 19 Nov 2017 14:02:50 +0800
changeset 35094 38fe3fe4bbb6
parent 35093 bd2743936b56
child 35095 4bc74bc78efd
hgweb: show instabilities of a commit In paper, coal, gitweb and monoblue a new "tag" (or multiple, if there are many instabilities) is added to the same line that has phase, branch, etc of a changeset; in gitweb and monoblue this element has a light red background, in paper and coal the element is black and underlined. In spartan theme instabilities are shown on a separate line. While test-obsolete.t uses first(phasedivergent()) revset to pick a changeset to test, that particular changeset is also an orphan, so two different instability tags are displayed.
mercurial/templates/gitweb/map
mercurial/templates/monoblue/map
mercurial/templates/paper/map
mercurial/templates/spartan/changelogentry.tmpl
mercurial/templates/spartan/changeset.tmpl
mercurial/templates/static/style-gitweb.css
mercurial/templates/static/style-monoblue.css
mercurial/templates/static/style-paper.css
tests/test-hgweb.t
tests/test-obsolete.t
--- a/mercurial/templates/gitweb/map	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/gitweb/map	Sun Nov 19 14:02:50 2017 +0800
@@ -264,11 +264,12 @@
 graph = graph.tmpl
 phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}'
 obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instabilitytag" title="{name|escape}">{name|escape}</span> '
 tagtag = '<span class="tagtag" title="{name|escape}">{name|escape}</span> '
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
-alltags = '<span class="logtags">{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
+alltags = '<span class="logtags">{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="age"><i class="age">{date|rfc822date}</i></td>
--- a/mercurial/templates/monoblue/map	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/monoblue/map	Sun Nov 19 14:02:50 2017 +0800
@@ -223,11 +223,12 @@
 shortlog = shortlog.tmpl
 phasetag = '{ifeq(phase, 'public', '', '<span class="phasetag" title="{phase|escape}">{phase|escape}</span> ')}'
 obsoletetag = '{if(obsolete, '<span class="obsoletetag" title="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instabilitytag" title="{name|escape}">{name|escape}</span> '
 tagtag = '<span class="tagtag" title="{name|escape}">{name|escape}</span> '
 branchtag = '<span class="branchtag" title="{name|escape}">{name|escape}</span> '
 inbranchtag = '<span class="inbranchtag" title="{name|escape}">{name|escape}</span> '
 bookmarktag = '<span class="bookmarktag" title="{name|escape}">{name|escape}</span> '
-alltags = '<span class="logtags">{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
+alltags = '<span class="logtags">{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
 shortlogentry = '
   <tr class="parity{parity}">
     <td class="nowrap age">{date|rfc822date}</td>
--- a/mercurial/templates/paper/map	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/paper/map	Sun Nov 19 14:02:50 2017 +0800
@@ -200,12 +200,13 @@
   </tr>'
 phasetag = '{ifeq(phase, 'public', '', '<span class="phase">{phase|escape}</span> ')}'
 obsoletetag = '{if(obsolete, '<span class="obsolete">obsolete</span> ')}'
+instabilitytag = '<span class="instability">{name|escape}</span> '
 changelogtag = '<span class="tag">{name|escape}</span> '
 changesettag = '<span class="tag">{tag|escape}</span> '
 changesetbookmark = '<span class="tag">{bookmark|escape}</span> '
 changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
 changelogbranchname = '<span class="branchname">{name|escape}</span> '
-alltags = '{phasetag}{obsoletetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
+alltags = '{phasetag}{obsoletetag}{instabilities%instabilitytag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   <tr>
--- a/mercurial/templates/spartan/changelogentry.tmpl	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/spartan/changelogentry.tmpl	Sun Nov 19 14:02:50 2017 +0800
@@ -26,6 +26,10 @@
   <th class="obsolete">obsolete:</th>
   <td class="obsolete">yes</td>
  </tr>')}
+ {ifeq(count(instabilities), '0', '', '<tr>
+  <th class="instabilities">instabilities:</th>
+  <td class="instabilities">{instabilities%"{name} "|escape}</td>
+ </tr>')}
  <tr>
   <th class="files"><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a>:</th>
   <td class="files">{files}</td>
--- a/mercurial/templates/spartan/changeset.tmpl	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/spartan/changeset.tmpl	Sun Nov 19 14:02:50 2017 +0800
@@ -41,6 +41,10 @@
  <th class="obsolete">obsolete:</th>
  <td class="obsolete">yes</td>
 </tr>')}
+{ifeq(count(instabilities), '0', '', '<tr>
+ <th class="instabilities">instabilities:</th>
+ <td class="instabilities">{instabilities%"{name} "|escape}</td>
+</tr>')}
 <tr>
  <th class="files">files:</th>
  <td class="files">{files}</td>
--- a/mercurial/templates/static/style-gitweb.css	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/static/style-gitweb.css	Sun Nov 19 14:02:50 2017 +0800
@@ -130,6 +130,10 @@
 	background-color: #dddddd;
 	border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
 }
+span.logtags span.instabilitytag {
+	background-color: #ffb1c0;
+	border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+}
 span.logtags span.tagtag {
 	background-color: #ffffaa;
 	border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
--- a/mercurial/templates/static/style-monoblue.css	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/static/style-monoblue.css	Sun Nov 19 14:02:50 2017 +0800
@@ -241,6 +241,10 @@
   background-color: #dddddd;
   border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
 }
+span.logtags span.instabilitytag {
+  background-color: #ffb1c0;
+  border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+}
 span.logtags span.tagtag {
   background-color: #ffffaa;
   border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
--- a/mercurial/templates/static/style-paper.css	Sun Nov 19 13:18:54 2017 +0800
+++ b/mercurial/templates/static/style-paper.css	Sun Nov 19 14:02:50 2017 +0800
@@ -155,6 +155,15 @@
   vertical-align: baseline;
 }
 
+.instability {
+  color: #000;
+  font-size: 70%;
+  border-bottom: 1px solid #000;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
 .tag {
   color: #999;
   font-size: 70%;
--- a/tests/test-hgweb.t	Sun Nov 19 13:18:54 2017 +0800
+++ b/tests/test-hgweb.t	Sun Nov 19 14:02:50 2017 +0800
@@ -340,7 +340,7 @@
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
   200 Script output follows
-  content-length: 9261
+  content-length: 9374
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@@ -475,6 +475,10 @@
   	background-color: #dddddd;
   	border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
   }
+  span.logtags span.instabilitytag {
+  	background-color: #ffb1c0;
+  	border-color: #ffbbc8 #ff4476 #ff4476 #ffbbc8;
+  }
   span.logtags span.tagtag {
   	background-color: #ffffaa;
   	border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
--- a/tests/test-obsolete.t	Sun Nov 19 13:18:54 2017 +0800
+++ b/tests/test-obsolete.t	Sun Nov 19 14:02:50 2017 +0800
@@ -1034,6 +1034,20 @@
     <th class="obsolete">obsolete:</th>
     <td class="obsolete">yes</td>
 
+check changeset with instabilities
+
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=paper' | grep '<span class="instability">'
+     <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=coal' | grep '<span class="instability">'
+     <span class="phase">draft</span> <span class="instability">orphan</span> <span class="instability">phase-divergent</span> 
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=gitweb' | grep '<span class="logtags">'
+    <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=monoblue' | grep '<span class="logtags">'
+          <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="instabilitytag" title="orphan">orphan</span> <span class="instabilitytag" title="phase-divergent">phase-divergent</span> </span>
+  $ get-with-headers.py localhost:$HGPORT 'log?rev=first(phasedivergent())&style=spartan' | grep 'class="instabilities"'
+    <th class="instabilities">instabilities:</th>
+    <td class="instabilities">orphan phase-divergent </td>
+
   $ killdaemons.py
 
   $ rm hg.pid access.log errors.log