# # # patch "TODO" # from [c02b42866e7b219f3e62a23a963a4e6168eff1b7] # to [edde29b03eeb75ef9d0cc89c8295fbeb64c5fbad] # # patch "common.py" # from [8747244a363d332bf91522eb44258c4ecf5cbccc] # to [ec4c49fe7950195f6897ce813aafdbe043b1154c] # # patch "revision.psp" # from [3f198ce41986db92a1cc0a0373d92a87ddf8b71f] # to [77bab654be272a249a635cf03c34f88aed76a042] # ============================================================ --- TODO c02b42866e7b219f3e62a23a963a4e6168eff1b7 +++ TODO edde29b03eeb75ef9d0cc89c8295fbeb64c5fbad @@ -20,3 +20,6 @@ URL to get the latest tar file of a branch. +Improve the manifest; icons next to files indicating type (steal the +icons from GNOME?) + ============================================================ --- common.py 8747244a363d332bf91522eb44258c4ecf5cbccc +++ common.py ec4c49fe7950195f6897ce813aafdbe043b1154c @@ -1,4 +1,5 @@ +import urllib import pydoc escape_function = pydoc.HTMLRepr().escape @@ -11,6 +12,40 @@ else: return e(x) +def link(link_type, link_to, description = None): + hq = html_escape() + if link_type == "revision": + rv = '[' % (urllib.quote(link_to)) + if description != None: rv += hq(description) + else: rv += hq(link_to[:8]) + ".." + rv += ']' + return rv + elif link_type == "diff": + rv = '' % (urllib.quote(link_to[0]), urllib.quote(link_to[1])) + if description != None: rv += hq(description) + else: rv += "diff" + rv += '' + return rv + elif link_type == "file": + if type(link_to) == type([]): + rv = '' % (urllib.quote(link_to[0]), urllib.quote(link_to[1])) + link_id = link_to[0] + else: + raise Exception(link_to) + rv = '' % (urllib.quote(link_to)) + link_id = link_to + if description != None: rv += hq(description) + "" + else: rv = "[" + rv + hq(link_id[:8]) + ".." + "]" + return rv + elif link_type == "branch": + rv = '' % (urllib.quote(link_to)) + if description != None: rv += hq(description) + else: rv += hq(link_to) + rv += '' + return rv + else: + rv = 'Unknown link type: %s' % (hq(link_type)) + def html_escape(): "returns a function stolen from pydoc that can be used to escape HTML" return lambda x: type_wrapper(escape_function, x) ============================================================ --- revision.psp 3f198ce41986db92a1cc0a0373d92a87ddf8b71f +++ revision.psp 77bab654be272a249a635cf03c34f88aed76a042 @@ -7,6 +7,8 @@ import template from template import header,footer from monotone import Monotone +reload(common) +from common import link # # revision.psp @@ -53,7 +55,7 @@ if not cert.has_key("Name") or not cert.has_key("Value"): continue name, value = cert["Name"][0], hq(cert["Value"]) if name == "branch": - value = '' % (urllib.quote(value)) + value + '' + value = link("branch", value) req.write('%s%s' % (hq(prettify(name)), value)) %> @@ -72,12 +74,12 @@ if type == "patch": fname, from_id, to_id = stanza[0][1], stanza[1][1], stanza[2][1] if not from_id: - value += 'Add file %s with revision %s
' % (hq(fname), urllib.quote(to_id), urllib.quote(fname), hq(to_id)) + value += 'Add file %s with revision %s
' % (hq(fname), link("file", [to_id, fname])) else: - value += 'Patch file %s from %s to %s (diff)
' % (hq(fname), urllib.quote(from_id), urllib.quote(fname), hq(from_id), urllib.quote(to_id), urllib.quote(fname), hq(to_id), urllib.quote(old_revision), urllib.quote(id), urllib.quote(fname)) + value += 'Patch file %s from %s to %s (%s)
' % (hq(fname), link("file", [from_id, fname]), link("file", [to_id, fname]), link("diff", [from_id, to_id])) elif type == "old_revision": old_revision, old_manifest = stanza[0][1], stanza[1][1] - value += 'Old revision is: %s (diff)
Old manifest: %s
' % (urllib.quote(old_revision), hq(old_revision), urllib.quote(old_revision), urllib.quote(id), hq(old_manifest)) + value += 'Old revision is: %s (%s)
Old manifest: %s
' % (link("revision", old_revision), link("diff", [old_revision, id]), hq(old_manifest)) elif type == "new_manifest": new_manifest = stanza[0][1] value += 'New manifest is: %s
' % (hq(old_manifest)) @@ -147,7 +149,7 @@ for id, filename in manifest: %> - <%='%s' % (urllib.quote(id), urllib.quote(filename), hq(filename))%> + <%=link("file", [id, filename], filename)%> <%