[PATCH 4/5]: cleaning the template parent management in hgweb
Goffredo Baroncelli
kreijack at libero.it
Sat Jul 2 10:10:05 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 4#
remove everywhere any reference to p1/p2/p1rev/p2rev which is not used in hgweb
# HG changeset patch
# User ghigo at therra.bhome
# Node ID a4967d67465ccf4b10f0c4eff9c6da3595d267ea
# Parent 7054fc4809624f30d38b09f9d16d39b877746156
hgweb: remove the p1,p2/p1rev,p2rev stuff
diff -r 7054fc480962 -r a4967d67465c mercurial/hgweb.py
--- a/mercurial/hgweb.py Sat Jul 2 14:56:28 2005
+++ b/mercurial/hgweb.py Sat Jul 2 15:05:16 2005
@@ -258,7 +258,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(
@@ -268,8 +267,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,
@@ -324,7 +321,6 @@
count += 1
hn = hex(n)
- p1, p2 = cl.parents(n)
t = float(changes[2].split(' ')[0])
yield self.t(
@@ -334,8 +330,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,
@@ -360,8 +354,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 = []
@@ -383,8 +376,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],
@@ -406,7 +397,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",
@@ -417,9 +407,7 @@
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)))
+ desc = cs[4]))
parity = 1 - parity
yield l
@@ -440,7 +428,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]
@@ -464,9 +451,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 = {}
@@ -478,7 +463,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]
@@ -531,9 +515,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))
@@ -632,7 +614,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 7054fc480962 -r a4967d67465c templates/template-vars.txt
--- a/templates/template-vars.txt Sat Jul 2 14:56:28 2005
+++ b/templates/template-vars.txt Sat Jul 2 15:05:16 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