# HG changeset patch # User Anton Shestakov <av6@dwimlabs.net> # Date 1511071370 -28800 # Sun Nov 19 14:02:50 2017 +0800 # Node ID 38fe3fe4bbb639d8bc082c5710ace24cb6f86375 # Parent bd2743936b56e2ff33dc59bb0baaf981c21754d9 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. diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map +++ b/mercurial/templates/gitweb/map @@ -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> diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map +++ b/mercurial/templates/monoblue/map @@ -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> diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map --- a/mercurial/templates/paper/map +++ b/mercurial/templates/paper/map @@ -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> diff --git a/mercurial/templates/spartan/changelogentry.tmpl b/mercurial/templates/spartan/changelogentry.tmpl --- a/mercurial/templates/spartan/changelogentry.tmpl +++ b/mercurial/templates/spartan/changelogentry.tmpl @@ -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> diff --git a/mercurial/templates/spartan/changeset.tmpl b/mercurial/templates/spartan/changeset.tmpl --- a/mercurial/templates/spartan/changeset.tmpl +++ b/mercurial/templates/spartan/changeset.tmpl @@ -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> diff --git a/mercurial/templates/static/style-gitweb.css b/mercurial/templates/static/style-gitweb.css --- a/mercurial/templates/static/style-gitweb.css +++ b/mercurial/templates/static/style-gitweb.css @@ -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; diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css --- a/mercurial/templates/static/style-monoblue.css +++ b/mercurial/templates/static/style-monoblue.css @@ -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; diff --git a/mercurial/templates/static/style-paper.css b/mercurial/templates/static/style-paper.css --- a/mercurial/templates/static/style-paper.css +++ b/mercurial/templates/static/style-paper.css @@ -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%; diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t --- a/tests/test-hgweb.t +++ b/tests/test-hgweb.t @@ -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; diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -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