[PATCH 4/5]: cleaning the template parent management in hgweb
Goffredo Baroncelli
kreijack at libero.it
Sun Jul 3 04:10:06 CDT 2005
On Sunday 03 July 2005 00:49, you (Matt Mackall) wrote:
> On Sun, Jul 03, 2005 at 12:22:35AM +0200, Goffredo Baroncelli wrote:
> > On Saturday 02 July 2005 22:40, you (Matt Mackall) wrote:
> > > On Sat, Jul 02, 2005 at 05:10:05PM +0200, Goffredo Baroncelli wrote:
> > > > - patch 4#
> > > > remove everywhere any reference to p1/p2/p1rev/p2rev which is not used in hgweb
> > >
> > > This one's no good. They're there so that new templates can be written
> > > that use them without touching the code.
> >
> > Sorry, i don't understand if you want to keep p1/p2/p1rev/p2rev in the code ( but in
> > this case all patch #4 have to be ignored ), or in the template ( but the patch removes the
> > reference to p1/p2/p[12]ref only in the readme file 'templates/template-vars.txt' );
> > could you please clarify me ? So I will rework the patch.
>
> Anywhere we were previously giving parent info to the templates, we
> ought to still in some form.
Now the patch remove every use of the tag p1/p2/p1rev/p2rev from the code ( even the ones
not used ), replacing everywhere with the tag parent ( even where the previous tag are not
use ), so the information to the templates is still given.
Goffredo
diff -r eb46971fc57f mercurial/hgweb.py
--- a/mercurial/hgweb.py Sun Jul 3 06:54:35 2005
+++ b/mercurial/hgweb.py Sun Jul 3 11:08:46 2005
@@ -254,7 +254,6 @@
n = cl.node(i)
changes = cl.read(n)
hn = hex(n)
- p1, p2 = cl.parents(n)
t = float(changes[2].split(' ')[0])
l.insert(0, self.t(
@@ -264,8 +263,6 @@
parent = self.parents("changelogparent",
cl.parents(n), cl.rev),
changelogtag = self.showtag("changelogtag",n),
- p1 = hex(p1), p2 = hex(p2),
- p1rev = cl.rev(p1), p2rev = cl.rev(p2),
manifest = hex(changes[0]),
desc = changes[4],
date = t,
@@ -320,7 +317,6 @@
count += 1
hn = hex(n)
- p1, p2 = cl.parents(n)
t = float(changes[2].split(' ')[0])
yield self.t(
@@ -330,8 +326,6 @@
parent = self.parents("changelogparent",
cl.parents(n), cl.rev),
changelogtag = self.showtag("changelogtag",n),
- p1 = hex(p1), p2 = hex(p2),
- p1rev = cl.rev(p1), p2rev = cl.rev(p2),
manifest = hex(changes[0]),
desc = changes[4],
date = t,
@@ -356,8 +350,7 @@
n = bin(nodeid)
cl = self.repo.changelog
changes = cl.read(n)
- p1, p2 = cl.parents(n)
- p1rev, p2rev = cl.rev(p1), cl.rev(p2)
+ p1 = cl.parents(n)[0]
t = float(changes[2].split(' ')[0])
files = []
@@ -379,8 +372,6 @@
parent = self.parents("changesetparent",
cl.parents(n), cl.rev),
changesettag = self.showtag("changesettag",n),
- p1 = hex(p1), p2 = hex(p2),
- p1rev = cl.rev(p1), p2rev = cl.rev(p2),
manifest = hex(changes[0]),
author = changes[1],
desc = changes[4],
@@ -402,7 +393,6 @@
lr = fl.linkrev(n)
cn = cl.node(lr)
cs = cl.read(cl.node(lr))
- p1, p2 = fl.parents(n)
t = float(cs[2].split(' ')[0])
l.insert(0, self.t("filelogentry",
@@ -413,9 +403,9 @@
node = hex(cn),
author = cs[1],
date = t,
- desc = cs[4],
- p1 = hex(p1), p2 = hex(p2),
- p1rev = fl.rev(p1), p2rev = fl.rev(p2)))
+ parent = self.parents("filelogparent",
+ fl.parents(n), fl.rev, file=f),
+ desc = cs[4]))
parity = 1 - parity
yield l
@@ -436,7 +426,6 @@
cl = self.repo.changelog
cn = cl.node(changerev)
cs = cl.read(cn)
- p1, p2 = fl.parents(n)
t = float(cs[2].split(' ')[0])
mfn = cs[0]
@@ -460,9 +449,7 @@
date = t,
parent = self.parents("filerevparent",
fl.parents(n), fl.rev, file=f),
- p1 = hex(p1), p2 = hex(p2),
- permissions = self.repo.manifest.readflags(mfn)[f],
- p1rev = fl.rev(p1), p2rev = fl.rev(p2))
+ permissions = self.repo.manifest.readflags(mfn)[f])
def fileannotate(self, f, node):
bcache = {}
@@ -474,7 +461,6 @@
cl = self.repo.changelog
cn = cl.node(changerev)
cs = cl.read(cn)
- p1, p2 = fl.parents(n)
t = float(cs[2].split(' ')[0])
mfn = cs[0]
@@ -527,9 +513,7 @@
date = t,
parent = self.parents("fileannotateparent",
fl.parents(n), fl.rev, file=f),
- p1 = hex(p1), p2 = hex(p2),
- permissions = self.repo.manifest.readflags(mfn)[f],
- p1rev = fl.rev(p1), p2rev = fl.rev(p2))
+ permissions = self.repo.manifest.readflags(mfn)[f])
def manifest(self, mnode, path):
mf = self.repo.manifest.read(bin(mnode))
@@ -628,7 +612,6 @@
rev = self.repo.changelog.rev(n),
parent = self.parents("filediffparent",
cl.parents(n), cl.rev),
- p1rev = self.repo.changelog.rev(p1),
diff = diff)
# add tags to things
diff -r eb46971fc57f templates/map
--- a/templates/map Sun Jul 3 06:54:35 2005
+++ b/templates/map Sun Jul 3 11:08:46 2005
@@ -33,3 +33,4 @@
changelogtag = "<tr><td align="right">tag: </td><td>#tag#</td></tr>"
changesettag = "<tr><td class="metatag">tag: </td><td>#tag#</td></tr>"
filediffparent = "<tr><td class="metatag">parent #rev#:</td><td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>"
+filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>"
diff -r eb46971fc57f templates/template-vars.txt
--- a/templates/template-vars.txt Sun Jul 3 06:54:35 2005
+++ b/templates/template-vars.txt Sun Jul 3 11:08:46 2005
@@ -17,8 +17,8 @@
desc a description (escaped, with breaks)
shortdesc a short description (escaped)
author a name or email addressv(obfuscated)
-p1, p2 parent nodes
-p1rev, p2rev parent revs
+parent a list of the parent
+tags a list of tag
header the global page header
footer the global page footer
More information about the Mercurial
mailing list