# # # patch "manifest.psp" # from [5b0cebd3558b2f6734b07fe71062f125d4e2cea5] # to [0b7950e1378e9504dc1e4dc12165683c40bdf358] # ============================================================ --- manifest.psp 5b0cebd3558b2f6734b07fe71062f125d4e2cea5 +++ manifest.psp 0b7950e1378e9504dc1e4dc12165683c40bdf358 @@ -1,11 +1,12 @@ <% -import config +import datetime import monotone import common +import config import urllib -import sets +import time from html import get_icon, TableWriter # @@ -89,7 +90,6 @@ # of the current revision, until we have that information for every # file in 'files' -req.write('here: %s
' % id) ancestors = mt.toposort(mt.ancestors([id])) ancestors.append(id) ancestors.reverse() # so we can iterate back through time.. @@ -112,9 +112,42 @@ found += 1 if found >= len(files): break +revinfo = {} +now = datetime.datetime.utcnow() +for filename in file_to_rev.keys(): + rev = file_to_rev[filename] + if revinfo.has_key(rev): continue + certs = mt.certs(rev) + ago, author, certdate, quicklog = None, None, None, None + for cert in certs: + name, value = None, None + for k, v in cert: + if k == "name": name = v + elif k == "value": value = v + if name == None or value == None: continue + if name == "date": + certdate = apply(datetime.datetime, time.strptime(value, "%Y-%m-%dT%H:%M:%S")[:6]) + elif name == "changelog": + quicklog = value.strip().split('\n')[0] + if quicklog.startswith('*'): quicklog = quicklog[1:].strip() + elif name == "author": + author = value + if certdate: + ago = now - certdate + if ago.days > 0: + ago = "%d days, %d hours" % (ago.days, ago.seconds / 3600) + elif ago.seconds > 3600: + hours = ago.seconds / 3600 + minutes = (ago.seconds - (hours * 3600)) / 60 + ago = "%d hours, %d minutes" % (hours, minutes) + else: + minutes = ago.seconds / 60 + seconds = (ago.seconds - (minutes * 60)) + ago = "%d minutes, %d seconds" % (minutes, seconds) + revinfo[rev] = (ago, author, quicklog) + if depth != 0: subdirs = [('..', '/'.join(sp[:-1]))] + subdirs -# req.write("%s %s %s
" % (str(sp), str(parts), depth)) tr = TableWriter(req) tr.start() @@ -128,9 +161,16 @@ if not rev: tr.write('%s' % (icon_uri, link("file", [file_id, file], name))) else: - tr.write('%s%s' % (icon_uri, \ + age, author, quicklog = revinfo[rev] + age = hq(age or "").replace(' ', ' ') + author = hq(author or "").replace(' ', ' ') + quicklog = hq(quicklog or "") + tr.write(' %s %s %s %s%s' % (icon_uri, \ link("file", [file_id, file], name), \ - link("revision", rev))) + link("revision", rev), \ + age, \ + author, \ + quicklog)) tr.stop() %>