Wed Sep 21 05:51:22 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Gather more information from annotate parsing.
Add a list of patches with their dates to the annotate object, because we'll
want to use them in patches to come. Also store the date in tuple format and
let the users do the conversion to text as they need to.
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2015-11-15 22:04:22.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2015-11-15 22:04:22.000000000 +0000
@@ -671,13 +671,18 @@
self.lastchange_hash = ""
self.lastchange_author = ""
self.lastchange_name = ""
+ self.lastchange_date = None
+ self.firstdate = None
+ self.lastdate = None
self.lines = []
+ self.patches = {}
class Line:
def __init__(self):
self.text = ""
self.phash = None
self.pauthor = None
+ self.pdate = None
def parse_annotate(src):
import xml.dom.minidom
@@ -712,8 +717,13 @@
lastdate = lastpatch.getAttribute("date")
lastdate = time.strptime(lastdate, "%Y%m%d%H%M%S")
- lastdate = time.strftime("%Y-%m-%d %H:%M:%S", lastdate)
- annotate.lastchange_date = fixu8(lastdate)
+ annotate.lastchange_date = lastdate
+
+ annotate.patches[annotate.lastchange_hash] = annotate.lastchange_date
+
+ # these will be overriden by the real dates later
+ annotate.firstdate = lastdate
+ annotate.lastdate = 0
file = dom.getElementsByTagName("file")[0]
@@ -729,7 +739,6 @@
pauthor = patch.getAttribute("author")
pdate = patch.getAttribute("date")
pdate = time.strptime(pdate, "%Y%m%d%H%M%S")
- pdate = time.strftime("%Y-%m-%d %H:%M:%S", pdate)
else:
# added lines inherit the creation from the annotate
# patch
@@ -750,8 +759,14 @@
line.text = fixu8(text)
line.phash = fixu8(phash)
line.pauthor = fixu8(pauthor)
- line.pdate = fixu8(pdate)
+ line.pdate = pdate
annotate.lines.append(line)
+ annotate.patches[line.phash] = line.pdate
+
+ if pdate > annotate.lastdate:
+ annotate.lastdate = pdate
+ if pdate < annotate.firstdate:
+ annotate.firstdate = pdate
return annotate
@@ -979,7 +994,8 @@
text = escape(l.text)
text = text.rstrip()
text = replace_tabs(text)
- title = "%s by %s" % (l.pdate, escape(l.pauthor) )
+ plongdate = time.strftime("%Y-%m-%d %H:%M:%S", l.pdate)
+ title = "%s by %s" % (plongdate, escape(l.pauthor) )
link = "%(myrname)s;a=commit;h=%(hash)s" % {
'myrname': config.myreponame,
@@ -987,8 +1003,7 @@
}
if l.phash != prevhash:
- pdate = time.strptime(l.pdate, "%Y-%m-%d %H:%M:%S")
- pdate = time.strftime("%Y-%m-%d", pdate)
+ pdate = time.strftime("%Y-%m-%d", l.pdate)
left = l.pauthor.find('<')
right = l.pauthor.find('@')