hgweb: show obsolescence status of a commit

As with phases, spartan theme shows a simple "obsolete: yes" on its own line
(this allows replacing "yes" with something more useful in future, like output
of obsfate* template functions). Everywhere else a new "tag" is added to the
same line that has phase, branch, etc of a changeset; in gitweb and monoblue
the element has gray background, in paper and coal the element is gray with a
dashed underline.
This commit is contained in:
Anton Shestakov 2017-11-18 12:04:08 +08:00
parent bc9b6ce350
commit 980f6b961e
10 changed files with 60 additions and 4 deletions

View File

@ -263,11 +263,12 @@ filecompchild = '
shortlog = shortlog.tmpl
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> ')}'
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}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
alltags = '<span class="logtags">{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
shortlogentry = '
<tr class="parity{parity}">
<td class="age"><i class="age">{date|rfc822date}</i></td>

View File

@ -222,11 +222,12 @@ filecompchild = '
<dd><a href="{url|urlescape}comparison/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></dd>'
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> ')}'
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}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
alltags = '<span class="logtags">{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}</span>'
shortlogentry = '
<tr class="parity{parity}">
<td class="nowrap age">{date|rfc822date}</td>

View File

@ -199,12 +199,13 @@ branchentry = '
</td>
</tr>'
phasetag = '{ifeq(phase, 'public', '', '<span class="phase">{phase|escape}</span> ')}'
obsoletetag = '{if(obsolete, '<span class="obsolete">obsolete</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}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
alltags = '{phasetag}{obsoletetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
filediffparent = '
<tr>

View File

@ -22,6 +22,10 @@
<th class="phase">phase:</th>
<td class="phase">{phase|escape}</td>
</tr>')}
{if(obsolete, '<tr>
<th class="obsolete">obsolete:</th>
<td class="obsolete">yes</td>
</tr>')}
<tr>
<th class="files"><a href="{url|urlescape}file/{node|short}{sessionvars%urlparameter}">files</a>:</th>
<td class="files">{files}</td>

View File

@ -37,6 +37,10 @@
<th class="phase">phase:</th>
<td class="phase">{phase|escape}</td>
</tr>')}
{if(obsolete, '<tr>
<th class="obsolete">obsolete:</th>
<td class="obsolete">yes</td>
</tr>')}
<tr>
<th class="files">files:</th>
<td class="files">{files}</td>

View File

@ -126,6 +126,10 @@ span.logtags span.phasetag {
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
}
span.logtags span.obsoletetag {
background-color: #dddddd;
border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
}
span.logtags span.tagtag {
background-color: #ffffaa;
border-color: #ffffcc #ffee00 #ffee00 #ffffcc;

View File

@ -237,6 +237,10 @@ span.logtags span.phasetag {
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
}
span.logtags span.obsoletetag {
background-color: #dddddd;
border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
}
span.logtags span.tagtag {
background-color: #ffffaa;
border-color: #ffffcc #ffee00 #ffee00 #ffffcc;

View File

@ -146,6 +146,15 @@ a { text-decoration:none; }
vertical-align: baseline;
}
.obsolete {
color: #999;
font-size: 70%;
border-bottom: 1px dashed #999;
font-weight: normal;
margin-left: .5em;
vertical-align: baseline;
}
.tag {
color: #999;
font-size: 70%;

View File

@ -340,7 +340,7 @@ static file
$ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
200 Script output follows
content-length: 9151
content-length: 9261
content-type: text/css
body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
@ -471,6 +471,10 @@ static file
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
}
span.logtags span.obsoletetag {
background-color: #dddddd;
border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
}
span.logtags span.tagtag {
background-color: #ffffaa;
border-color: #ffffcc #ffee00 #ffee00 #ffffcc;

View File

@ -1015,6 +1015,30 @@ test summary output
orphan: 2 changesets
phase-divergent: 1 changesets
#if serve
$ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
$ cat hg.pid >> $DAEMON_PIDS
check obsolete changeset
$ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=paper' | grep '<span class="obsolete">'
<span class="phase">draft</span> <span class="obsolete">obsolete</span>
$ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=coal' | grep '<span class="obsolete">'
<span class="phase">draft</span> <span class="obsolete">obsolete</span>
$ get-with-headers.py localhost:$HGPORT 'log?rev=first(obsolete())&style=gitweb' | grep '<span class="logtags">'
<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=monoblue' | grep '<span class="logtags">'
<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">yes</td>
$ killdaemons.py
$ rm hg.pid access.log errors.log
#endif
Test incoming/outcoming with changesets obsoleted remotely, known locally
===============================================================================