changeset 8713:de6bb29e208a

hgweb: allow distinction between open/closed branches on branches page
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 04 Jun 2009 18:05:50 +0200
parents dd3ebf81af43
children 505a96cbc923
files mercurial/hgweb/webcommands.py templates/coal/map templates/gitweb/map templates/monoblue/map templates/paper/map templates/spartan/map templates/static/style-coal.css templates/static/style-paper.css tests/test-hgweb-commands.out
diffstat 9 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Jun 03 17:12:48 2009 -0500
+++ b/mercurial/hgweb/webcommands.py	Thu Jun 04 18:05:50 2009 +0200
@@ -361,16 +361,20 @@
 def branches(web, req, tmpl):
     b = web.repo.branchtags()
     tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
+    open = set(web.repo[n].branch() for n in web.repo.heads(closed=False))
     parity = paritygen(web.stripecount)
+    sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev())
 
     def entries(limit, **map):
         count = 0
-        for ctx in sorted(tips, key=lambda x: x.rev(), reverse=True):
+        for ctx in sorted(tips, key=sortkey, reverse=True):
             if limit > 0 and count >= limit:
                 return
             count += 1
+            status = ctx.branch() in open and 'open' or 'closed'
             yield {'parity': parity.next(),
                    'branch': ctx.branch(),
+                   'status': status,
                    'node': ctx.hex(),
                    'date': ctx.date()}
 
--- a/templates/coal/map	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/coal/map	Thu Jun 04 18:05:50 2009 +0200
@@ -136,7 +136,7 @@
 branchentry = '
   <tr class="tagEntry parity{parity}">
     <td>
-      <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">
+      <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}" class="{status}">
         {branch|escape}
       </a>
     </td>
--- a/templates/gitweb/map	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/gitweb/map	Thu Jun 04 18:05:50 2009 +0200
@@ -165,7 +165,7 @@
   <tr class="parity{parity}">
     <td class="age"><i>{date|age} ago</i></td>
     <td><a class="list" href="{url}shortlog/{node|short}{sessionvars%urlparameter}"><b>{node|short}</b></a></td>
-    <td>{branch|escape}</td>
+    <td class="{status}">{branch|escape}</td>
     <td class="link">
       <a href="{url}changeset/{node|short}{sessionvars%urlparameter}">changeset</a> |
       <a href="{url}log/{node|short}{sessionvars%urlparameter}">changelog</a> |
--- a/templates/monoblue/map	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/monoblue/map	Thu Jun 04 18:05:50 2009 +0200
@@ -142,7 +142,7 @@
   <tr class="parity{parity}">
     <td class="nowrap">{date|age} ago</td>
     <td><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{node|short}</a></td>
-    <td>{branch|escape}</td>
+    <td class="{status}">{branch|escape}</td>
     <td class="nowrap">
       <a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> |
       <a href="{url}log/{node|short}{sessionvars%urlparameter}">changelog</a> |
--- a/templates/paper/map	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/paper/map	Thu Jun 04 18:05:50 2009 +0200
@@ -136,7 +136,7 @@
 branchentry = '
   <tr class="tagEntry parity{parity}">
     <td>
-      <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">
+      <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}" class="{status}">
         {branch|escape}
       </a>
     </td>
--- a/templates/spartan/map	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/spartan/map	Thu Jun 04 18:05:50 2009 +0200
@@ -133,7 +133,7 @@
 branchentry = '
   <li class="tagEntry parity{parity}">
     <tt class="node">{node}</tt>
-    <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{branch|escape}</a>
+    <a href="{url}shortlog/{node|short}{sessionvars%urlparameter}" class="{status}">{branch|escape}</a>
   </li>'
 diffblock = '<pre class="parity{parity}">{lines}</pre>'
 changelogtag = '<tr><th class="tag">tag:</th><td class="tag">{tag|escape}</td></tr>'
--- a/templates/static/style-coal.css	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/static/style-coal.css	Thu Jun 04 18:05:50 2009 +0200
@@ -196,6 +196,8 @@
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
 
+.tagEntry .closed { color: #99f; }
+
 /* Changeset entry */
 #changesetEntry {
   border-collapse: collapse;
--- a/templates/static/style-paper.css	Wed Jun 03 17:12:48 2009 -0500
+++ b/templates/static/style-paper.css	Thu Jun 04 18:05:50 2009 +0200
@@ -185,6 +185,8 @@
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
 
+.tagEntry .closed { color: #99f; }
+
 /* Changeset entry */
 #changesetEntry {
   border-collapse: collapse;
--- a/tests/test-hgweb-commands.out	Wed Jun 03 17:12:48 2009 -0500
+++ b/tests/test-hgweb-commands.out	Thu Jun 04 18:05:50 2009 +0200
@@ -522,7 +522,7 @@
 <tr class="parity0">
 <td class="age"><i>many years ago</i></td>
 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
-<td>stable</td>
+<td class="open">stable</td>
 <td class="link">
 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
@@ -532,7 +532,7 @@
 <tr class="parity1">
 <td class="age"><i>many years ago</i></td>
 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
-<td>default</td>
+<td class="closed">default</td>
 <td class="link">
 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |
@@ -670,7 +670,7 @@
 <tr class="parity0">
 <td class="age"><i>many years ago</i></td>
 <td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
-<td>stable</td>
+<td class="">stable</td>
 <td class="link">
 <a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
 <a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
@@ -680,7 +680,7 @@
 <tr class="parity1">
 <td class="age"><i>many years ago</i></td>
 <td><a class="list" href="/shortlog/a4f92ed23982?style=gitweb"><b>a4f92ed23982</b></a></td>
-<td>default</td>
+<td class="">default</td>
 <td class="link">
 <a href="/changeset/a4f92ed23982?style=gitweb">changeset</a> |
 <a href="/log/a4f92ed23982?style=gitweb">changelog</a> |