changeset 1416:19d2776f1725

hgweb: hide trivial parent (like in show_changeset)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 19 Oct 2005 20:54:46 -0700
parents c6e6ca96a033
children 90b62337f8dd
files mercurial/hgweb.py templates/changelogentry.tmpl templates/changeset-raw.tmpl templates/changeset.tmpl templates/fileannotate.tmpl templates/filediff.tmpl templates/filerevision.tmpl
diffstat 7 files changed, 20 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Wed Oct 19 00:10:52 2005 -0700
+++ b/mercurial/hgweb.py	Wed Oct 19 20:54:46 2005 -0700
@@ -198,12 +198,14 @@
         if len(files) > self.maxfiles:
             yield self.t("fileellipses")
 
-    def parents(self, t1, nodes=[], rev=None,**args):
+    def parents(self, node, parents=[], rev=None, hide=False, **args):
         if not rev:
             rev = lambda x: ""
-        for node in nodes:
-            if node != nullid:
-                yield self.t(t1, node=hex(node), rev=rev(node), **args)
+        parents = [p for p in parents if p != nullid]
+        if hide and len(parents) == 1 and rev(parents[0]) == rev(node) - 1:
+            return
+        for p in parents:
+            yield dict(node=hex(p), rev=rev(p), **args)
 
     def showtag(self, t1, node=nullid, **args):
         for t in self.repo.nodetags(node):
@@ -305,8 +307,8 @@
 
                 l.insert(0, {"parity": parity,
                              "author": changes[1],
-                             "parent": self.parents("changelogparent",
-                                                    cl.parents(n), cl.rev),
+                             "parent": self.parents(n, cl.parents(n), cl.rev,
+                                                    hide=True),
                              "changelogtag": self.showtag("changelogtag",n),
                              "manifest": hex(changes[0]),
                              "desc": changes[4],
@@ -366,8 +368,7 @@
                 yield self.t('searchentry',
                              parity=count & 1,
                              author=changes[1],
-                             parent=self.parents("changelogparent",
-                                                 cl.parents(n), cl.rev),
+                             parent=self.parents(n, cl.parents(n), cl.rev),
                              changelogtag=self.showtag("changelogtag",n),
                              manifest=hex(changes[0]),
                              desc=changes[4],
@@ -412,8 +413,7 @@
                      diff=diff,
                      rev=cl.rev(n),
                      node=nodeid,
-                     parent=self.parents("changesetparent",
-                                         cl.parents(n), cl.rev),
+                     parent=self.parents(n, cl.parents(n), cl.rev),
                      changesettag=self.showtag("changesettag",n),
                      manifest=hex(changes[0]),
                      author=changes[1],
@@ -445,8 +445,7 @@
                              "node": hex(cn),
                              "author": cs[1],
                              "date": cs[2],
-                             "parent": self.parents("filelogparent",
-                                                    fl.parents(n),
+                             "parent": self.parents(n, fl.parents(n),
                                                     fl.rev, file=f),
                              "desc": cs[4]})
                 parity = 1 - parity
@@ -490,8 +489,7 @@
                      manifest=hex(mfn),
                      author=cs[1],
                      date=cs[2],
-                     parent=self.parents("filerevparent",
-                                         fl.parents(n), fl.rev, file=f),
+                     parent=self.parents(n, fl.parents(n), fl.rev, file=f),
                      permissions=self.repo.manifest.readflags(mfn)[f])
 
     def fileannotate(self, f, node):
@@ -543,8 +541,7 @@
                      manifest=hex(mfn),
                      author=cs[1],
                      date=cs[2],
-                     parent=self.parents("fileannotateparent",
-                                         fl.parents(n), fl.rev, file=f),
+                     parent=self.parents(n, fl.parents(n), fl.rev, file=f),
                      permissions=self.repo.manifest.readflags(mfn)[f])
 
     def manifest(self, mnode, path):
@@ -648,8 +645,7 @@
                      filenode=hex(mf.get(file, nullid)),
                      node=changeset,
                      rev=self.repo.changelog.rev(n),
-                     parent=self.parents("filediffparent",
-                                         cl.parents(n), cl.rev),
+                     parent=self.parents(n, cl.parents(n), cl.rev),
                      diff=diff)
 
     def archive(self, req, cnode, type):
--- a/templates/changelogentry.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/changelogentry.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -7,7 +7,7 @@
   <th class="changesetRev">changeset #rev#:</th>
   <td class="changesetNode"><a href="?cs=#node|short#">#node|short#</a></td>
  </tr>
- #parent#
+ #parent%changelogparent#
  #changelogtag#
  <tr>
   <th class="author">author:</th>
--- a/templates/changeset-raw.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/changeset-raw.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -3,7 +3,7 @@
 # User #author#
 # Date #date|date#
 # Node ID #node#
-#parent#
+#parent%changesetparent#
 #desc#
 
 #diff#
--- a/templates/changeset.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/changeset.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -18,7 +18,7 @@
  <th class="changeset">changeset #rev#:</th>
  <td class="changeset"><a href="?cs=#node|short#">#node|short#</a></td>
 </tr>
-#parent#
+#parent%changesetparent#
 #changesettag#
 <tr>
  <th class="author">author:</th>
--- a/templates/fileannotate.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/fileannotate.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -18,7 +18,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
-#parent#
+#parent%fileannotateparent#
 <tr>
  <td class="metatag">author:</td>
  <td>#author|obfuscate#</td></tr>
--- a/templates/filediff.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/filediff.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -20,7 +20,7 @@
  <th class="revision">revision #rev#:</th>
  <td class="revision"><a href="?cs=#node|short#">#node|short#</a></td>
 </tr>
-#parent#
+#parent%filediffparent#
 </table>
 
 <div id="fileDiff">
--- a/templates/filerevision.tmpl	Wed Oct 19 00:10:52 2005 -0700
+++ b/templates/filerevision.tmpl	Wed Oct 19 20:54:46 2005 -0700
@@ -19,7 +19,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
-#parent#
+#parent%filerevparent#
 <tr>
  <td class="metatag">author:</td>
  <td>#author|obfuscate#</td></tr>