[PATCH 2/5]: cleaning the template parent management in hgweb

Goffredo Baroncelli kreijack at libero.it
Sat Jul 2 10:10:01 CDT 2005


Hi,

the template pages contain two entry named #parent1# and #parent2#; this is no good
because with the template system implemented in hgweb both the functions 
can be replaced with only one entry named "#parent#".
The code in hgweb will replace this tag with the appropriate number of parents ( one, two...
or more if and when will be used ).

The first two patch perform this change in two step: 
1) change the code to manage only one entry ( #parent1# )
2) remove any reference to #parent2#, and change both the code and the templates to
   rename #parent1# in #parent2#

the last three patchs are clean-up.

The patch are five

- patch #2
- clean the template page: replace #parent2# and #parent1# with #parent#; adjust also
the code

# HG changeset patch
# User ghigo at therra.bhome
# Node ID be3ca8530ece7174bd1dfa8d4c63b5dee36b15e3
# Parent  f67e85c2419e9a914a2f52e48ab68ae41c259fe6

hgweb: rename #parent1# and #parent2# to #parent# in the template managment

diff -r f67e85c2419e -r be3ca8530ece mercurial/hgweb.py
--- a/mercurial/hgweb.py        Sat Jul  2 09:38:19 2005
+++ b/mercurial/hgweb.py        Sat Jul  2 09:45:11 2005
@@ -265,7 +265,7 @@
                     'changelogentry',
                     parity = parity,
                     author = changes[1],
-                    parent1 = self.parents("changelogparent",
+                    parent = self.parents("changelogparent",
                                           cl.parents(n), cl.rev),
                     changelogtag = self.showtag("changelogtag",n),
                     p1 = hex(p1), p2 = hex(p2),
@@ -331,7 +331,7 @@
                     'searchentry',
                     parity = count & 1,
                     author = changes[1],
-                    parent1 = self.parents("changelogparent",
+                    parent = self.parents("changelogparent",
                                           cl.parents(n), cl.rev),
                     changelogtag = self.showtag("changelogtag",n),
                     p1 = hex(p1), p2 = hex(p2),
@@ -380,7 +380,7 @@
                      diff = diff,
                      rev = cl.rev(n),
                      node = nodeid,
-                     parent1 = self.parents("changesetparent",
+                     parent = self.parents("changesetparent",
                                            cl.parents(n), cl.rev),
                      changesettag = self.showtag("changesettag",n),
                      p1 = hex(p1), p2 = hex(p2),
@@ -462,7 +462,7 @@
                      manifest = hex(mfn),
                      author = cs[1],
                      date = t,
-                     parent1 = self.parents("filerevparent",
+                     parent = self.parents("filerevparent",
                                            fl.parents(n), fl.rev, file=f),
                      p1 = hex(p1), p2 = hex(p2),
                      permissions = self.repo.manifest.readflags(mfn)[f],
@@ -529,7 +529,7 @@
                      manifest = hex(mfn),
                      author = cs[1],
                      date = t,
-                     parent1 = self.parents("fileannotateparent",
+                     parent = self.parents("fileannotateparent",
                                            fl.parents(n), fl.rev, file=f),
                      p1 = hex(p1), p2 = hex(p2),
                      permissions = self.repo.manifest.readflags(mfn)[f],
diff -r f67e85c2419e -r be3ca8530ece templates/changelogentry.tmpl
--- a/templates/changelogentry.tmpl     Sat Jul  2 09:38:19 2005
+++ b/templates/changelogentry.tmpl     Sat Jul  2 09:45:11 2005
@@ -6,8 +6,7 @@
 <tr>
  <td align="right">changeset #rev#:&nbsp;</td>
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
-#parent1#
-#parent2#
+#parent#
 #changelogtag#
 <tr>
  <td align="right">author:&nbsp;</td>
diff -r f67e85c2419e -r be3ca8530ece templates/changeset-raw.tmpl
--- a/templates/changeset-raw.tmpl      Sat Jul  2 09:38:19 2005
+++ b/templates/changeset-raw.tmpl      Sat Jul  2 09:45:11 2005
@@ -3,8 +3,7 @@
 # User #author#
 # Date #date|date#
 # Node ID #node#
-#parent1#
-#parent2#
+#parent#
 #desc#

 #diff#
diff -r f67e85c2419e -r be3ca8530ece templates/changeset.tmpl
--- a/templates/changeset.tmpl  Sat Jul  2 09:38:19 2005
+++ b/templates/changeset.tmpl  Sat Jul  2 09:45:11 2005
@@ -16,8 +16,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
-#parent1#
-#parent2#
+#parent#
 #changesettag#
 <tr>
  <td class="metatag">manifest:</td>
diff -r f67e85c2419e -r be3ca8530ece templates/fileannotate.tmpl
--- a/templates/fileannotate.tmpl       Sat Jul  2 09:38:19 2005
+++ b/templates/fileannotate.tmpl       Sat Jul  2 09:45:11 2005
@@ -18,8 +18,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
-#parent1#
-#parent2#
+#parent#
 <tr>
  <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#manifest|short#</a></td></tr>
diff -r f67e85c2419e -r be3ca8530ece templates/filerevision.tmpl
--- a/templates/filerevision.tmpl       Sat Jul  2 09:38:19 2005
+++ b/templates/filerevision.tmpl       Sat Jul  2 09:45:11 2005
@@ -19,8 +19,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
-#parent1#
-#parent2#
+#parent#
 <tr>
  <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#manifest|short#</a></td></tr>
diff -r f67e85c2419e -r be3ca8530ece templates/searchentry.tmpl
--- a/templates/searchentry.tmpl        Sat Jul  2 09:38:19 2005
+++ b/templates/searchentry.tmpl        Sat Jul  2 09:45:11 2005
@@ -6,8 +6,7 @@
 <tr>
  <td align="right">changeset #rev#:&nbsp;</td>
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
-#parent1#
-#parent2#
+#parent#
 #changelogtag#
 <tr>
  <td align="right">author:&nbsp;</td>



More information about the Mercurial mailing list