changeset 1606:ba625c8083d8

- duplicate the parent link logic to show child links - don't show trivial parent or children links
author Muli Ben-Yehuda <mulix@mulix.org>
date Thu, 29 Dec 2005 14:51:29 -0600
parents 428e0a9c9968
children d72d27ee72b9
files mercurial/hgweb.py templates/changelogentry.tmpl templates/changeset-gitweb.tmpl templates/changeset.tmpl templates/fileannotate-gitweb.tmpl templates/fileannotate.tmpl templates/filediff.tmpl templates/filerevision-gitweb.tmpl templates/filerevision.tmpl templates/map templates/map-gitweb templates/map-raw templates/template-vars.txt
diffstat 13 files changed, 44 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Wed Dec 28 07:22:26 2005 -0800
+++ b/mercurial/hgweb.py	Thu Dec 29 14:51:29 2005 -0600
@@ -212,14 +212,14 @@
         if len(files) > self.maxfiles:
             yield self.t("fileellipses")
 
-    def parents(self, node, parents=[], rev=None, hide=False, **args):
+    def siblings(self, siblings=[], rev=None, hiderev=None, **args):
         if not rev:
             rev = lambda x: ""
-        parents = [p for p in parents if p != nullid]
-        if hide and len(parents) == 1 and rev(parents[0]) == rev(node) - 1:
+        siblings = [s for s in siblings if s != nullid]
+        if len(siblings) == 1 and rev(siblings[0]) == hiderev:
             return
-        for p in parents:
-            yield dict(node=hex(p), rev=rev(p), **args)
+        for s in siblings:
+            yield dict(node=hex(s), rev=rev(s), **args)
 
     def showtag(self, t1, node=nullid, **args):
         for t in self.repo.nodetags(node):
@@ -321,8 +321,10 @@
 
                 l.insert(0, {"parity": parity,
                              "author": changes[1],
-                             "parent": self.parents(n, cl.parents(n), cl.rev,
-                                                    hide=True),
+                             "parent": self.siblings(cl.parents(n), cl.rev,
+                                                     cl.rev(n) - 1),
+                             "child": self.siblings(cl.children(n), cl.rev,
+                                                    cl.rev(n) + 1),
                              "changelogtag": self.showtag("changelogtag",n),
                              "manifest": hex(changes[0]),
                              "desc": changes[4],
@@ -382,7 +384,8 @@
                 yield self.t('searchentry',
                              parity=count & 1,
                              author=changes[1],
-                             parent=self.parents(n, cl.parents(n), cl.rev),
+                             parent=self.siblings(cl.parents(n), cl.rev),
+                             child=self.siblings(cl.children(n), cl.rev),
                              changelogtag=self.showtag("changelogtag",n),
                              manifest=hex(changes[0]),
                              desc=changes[4],
@@ -422,7 +425,8 @@
                      diff=diff,
                      rev=cl.rev(n),
                      node=nodeid,
-                     parent=self.parents(n, cl.parents(n), cl.rev),
+                     parent=self.siblings(cl.parents(n), cl.rev),
+                     child=self.siblings(cl.children(n), cl.rev),
                      changesettag=self.showtag("changesettag",n),
                      manifest=hex(changes[0]),
                      author=changes[1],
@@ -454,7 +458,9 @@
                              "node": hex(cn),
                              "author": cs[1],
                              "date": cs[2],
-                             "parent": self.parents(n, fl.parents(n),
+                             "parent": self.siblings(fl.parents(n),
+                                                     fl.rev, file=f),
+                             "child": self.siblings(fl.children(n),
                                                     fl.rev, file=f),
                              "desc": cs[4]})
                 parity = 1 - parity
@@ -498,7 +504,8 @@
                      manifest=hex(mfn),
                      author=cs[1],
                      date=cs[2],
-                     parent=self.parents(n, fl.parents(n), fl.rev, file=f),
+                     parent=self.siblings(fl.parents(n), fl.rev, file=f),
+                     child=self.siblings(fl.children(n), fl.rev, file=f),
                      permissions=self.repo.manifest.readflags(mfn)[f])
 
     def fileannotate(self, f, node):
@@ -550,7 +557,8 @@
                      manifest=hex(mfn),
                      author=cs[1],
                      date=cs[2],
-                     parent=self.parents(n, fl.parents(n), fl.rev, file=f),
+                     parent=self.siblings(fl.parents(n), fl.rev, file=f),
+                     child=self.siblings(fl.children(n), fl.rev, file=f),
                      permissions=self.repo.manifest.readflags(mfn)[f])
 
     def manifest(self, mnode, path):
@@ -727,7 +735,8 @@
                      filenode=hex(mf.get(file, nullid)),
                      node=changeset,
                      rev=self.repo.changelog.rev(n),
-                     parent=self.parents(n, cl.parents(n), cl.rev),
+                     parent=self.siblings(cl.parents(n), cl.rev),
+                     child=self.siblings(cl.children(n), cl.rev),
                      diff=diff)
 
     def archive(self, req, cnode, type):
--- a/templates/changelogentry.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/changelogentry.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -8,6 +8,7 @@
   <td class="changesetNode"><a href="?cs=#node|short#">#node|short#</a></td>
  </tr>
  #parent%changelogparent#
+ #child%changelogchild#
  #changelogtag#
  <tr>
   <th class="author">author:</th>
--- a/templates/changeset-gitweb.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/changeset-gitweb.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -23,6 +23,7 @@
 <tr><td>changeset</td><td style="font-family:monospace">#node|short#</td></tr>
 <tr><td>manifest</td><td style="font-family:monospace"><a class="list" href="?cmd=manifest;manifest=#manifest|short#;path=/;style=gitweb">#manifest|short#</a></td></tr>
 #parent%changesetparent#
+#child%changesetchild#
 #changesettag#
 </table></div>
 
--- a/templates/changeset.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/changeset.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -19,6 +19,7 @@
  <td class="changeset"><a href="?cs=#node|short#">#node|short#</a></td>
 </tr>
 #parent%changesetparent#
+#child%changesetchild#
 #changesettag#
 <tr>
  <th class="author">author:</th>
--- a/templates/fileannotate-gitweb.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/fileannotate-gitweb.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -20,6 +20,7 @@
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#;style=gitweb">#node|short#</a></td></tr>
 #parent%fileannotateparent#
+#child%fileannotatechild#
 <tr>
  <td class="metatag">manifest:</td>
  <td><a href="?mf=#manifest|short#;path=/;style=gitweb">#manifest|short#</a></td></tr>
--- a/templates/fileannotate.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/fileannotate.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -19,6 +19,7 @@
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
 #parent%fileannotateparent#
+#child%fileannotatechild#
 <tr>
  <td class="metatag">author:</td>
  <td>#author|obfuscate#</td></tr>
--- a/templates/filediff.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/filediff.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -21,6 +21,7 @@
  <td class="revision"><a href="?cs=#node|short#">#node|short#</a></td>
 </tr>
 #parent%filediffparent#
+#child%filediffchild#
 </table>
 
 <div id="fileDiff">
--- a/templates/filerevision-gitweb.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/filerevision-gitweb.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -20,6 +20,7 @@
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#;style=gitweb">#node|short#</a></td></tr>
 #parent%fileannotateparent#
+#child%fileannotatechild#
 <tr>
  <td class="metatag">manifest:</td>
  <td><a href="?mf=#manifest|short#;path=/;style=gitweb">#manifest|short#</a></td></tr>
--- a/templates/filerevision.tmpl	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/filerevision.tmpl	Thu Dec 29 14:51:29 2005 -0600
@@ -20,6 +20,7 @@
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
 #parent%filerevparent#
+#child%filerevchild#
 <tr>
  <td class="metatag">author:</td>
  <td>#author|obfuscate#</td></tr>
--- a/templates/map	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/map	Thu Dec 29 14:51:29 2005 -0600
@@ -28,6 +28,10 @@
 changesetparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
 filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?f=#node|short#;file=#file#">#node|short#</a></td></tr>"
 fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?fa=#filenode|short#;file=#file#">#node|short#</a></td></tr>"
+changesetchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
+changelogchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
+filerevchild = "<tr><td class="metatag">child:</td><td><a href="?f=#node|short#;file=#file#">#node|short#</a></td></tr>"
+fileannotatechild = "<tr><td class="metatag">child:</td><td><a href="?fa=#filenode|short#;file=#file#">#node|short#</a></td></tr>"
 tags = tags.tmpl
 tagentry = "<li class="tagEntry parity#parity#"><span class="node">#node#</span> <a href="?cs=#node|short#">#tag#</a></li>"
 diffblock = "<pre class="parity#parity#">#lines#</pre>"
@@ -35,6 +39,8 @@
 changesettag = "<tr><th class="tag">tag:</th><td class="tag">#tag#</td></tr>"
 filediffparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
 filelogparent = "<tr><td align="right">parent #rev#:&nbsp;</td><td><a href="?f=#node|short#;file=#file#">#node|short#</a></td></tr>"
+filediffchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
+filelogchild = "<tr><td align="right">child #rev#:&nbsp;</td><td><a href="?f=#node|short#;file=#file#">#node|short#</a></td></tr>"
 indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#contact|obfuscate#</td><td>#lastupdate|age# ago</td><td><a href="#url#?cl=tip;style=rss">RSS</a></td></tr>"
 index = index.tmpl
 archiveentry = "<a href="?ca=#node|short#;type=#type#">#type#</a> "
--- a/templates/map-gitweb	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/map-gitweb	Thu Dec 29 14:51:29 2005 -0600
@@ -30,6 +30,10 @@
 changesetparent = "<tr><td>parent</td><td style="font-family:monospace"><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb">#node|short#</a></td></tr>"
 filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=file;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
 fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=annotate;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
+changelogchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cmd=changeset;node=#node#;style=gitweb">#node|short#</a></td></tr>"
+changesetchild = "<tr><td>child</td><td style="font-family:monospace"><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb">#node|short#</a></td></tr>"
+filerevchild = "<tr><td class="metatag">child:</td><td><a href="?cmd=file;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
+fileannotatechild = "<tr><td class="metatag">child:</td><td><a href="?cmd=annotate;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
 tags = tags-gitweb.tmpl
 tagentry = "<tr class="parity#parity#"><td><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#tag#</b></a></td><td class="link"><a href="?cmd=changeset;node=#node|short#;style=gitweb">changeset</a> | <a href="?cmd=changelog;rev=#node|short#;style=gitweb">changelog</a> |  <a href="?mf=#tagmanifest|short#;path=/;style=gitweb">manifest</a></td></tr>"
 diffblock = "#lines#"
@@ -37,6 +41,8 @@
 changesettag = "<tr><td>tag</td><td>#tag#</td></tr>"
 filediffparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cmd=changeset;node=#node#;style=gitweb">#node|short#</a></td></tr>"
 filelogparent = "<tr><td align="right">parent #rev#:&nbsp;</td><td><a href="?cmd=file;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
+filediffchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cmd=changeset;node=#node#;style=gitweb">#node|short#</a></td></tr>"
+filelogchild = "<tr><td align="right">child #rev#:&nbsp;</td><td><a href="?cmd=file;file=#file#;filenode=#node#;style=gitweb">#node|short#</a></td></tr>"
 shortlog = shortlog-gitweb.tmpl
 shortlogentry = "<tr class="parity#parity#"><td><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|firstline|escape#</b></a></td><td class="link"><a href="?cmd=changeset;node=#node|short#;style=gitweb">changeset</a> |  <a href="?cmd=manifest;manifest=#manifest|short#;path=/;style=gitweb">manifest</a></td></tr>"
 filelogentry = "<tr class="parity#parity#"><td><i>#date|age# ago</i></td><td><a class="list" href="?cmd=changeset;node=#node|short#;style=gitweb"><b>#desc|firstline|escape#</b></a></td><td class="link"><!-- FIXME: <a href="?fd=#node|short#;file=#file#;style=gitweb">diff</a> | --> <a href="?fa=#filenode|short#;file=#file#;style=gitweb">annotate</a></td></tr>"
--- a/templates/map-raw	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/map-raw	Thu Dec 29 14:51:29 2005 -0600
@@ -7,6 +7,7 @@
 difflineat = "#line#"
 diffline = "#line#"
 changesetparent = "# parent: #node#"
+changesetchild = "# child: #node#"
 filenodelink = "#file#"
 filerevision = filerevision-raw.tmpl
 fileline = "#line#"
--- a/templates/template-vars.txt	Wed Dec 28 07:22:26 2005 -0800
+++ b/templates/template-vars.txt	Thu Dec 29 14:51:29 2005 -0600
@@ -18,6 +18,7 @@
 shortdesc         a short description (escaped)
 author        a name or email addressv(obfuscated)
 parent        a list of the parent
+child         a list of the children
 tags          a list of tag
 
 header        the global page header