# # # patch "monotone.py" # from [ecadcd66e3ff78777cbc679554d8198c67aee5d6] # to [fa4671a5ad03c9e77fa0e4635ded7e386f0d3e24] # # patch "revision.psp" # from [7f933a135197c878bb614f4c25ab23f36f7073a5] # to [78f4a1f16fcaf297130c97fc812a57fde57762a8] # ============================================================ --- monotone.py ecadcd66e3ff78777cbc679554d8198c67aee5d6 +++ monotone.py fa4671a5ad03c9e77fa0e4635ded7e386f0d3e24 @@ -1,5 +1,6 @@ import utility +import string import urllib import pipes import sets @@ -134,6 +135,10 @@ if entry: rv.append(entry) return rv def ancestry_graph(self, graphdir, graphuri, id, limit=0): + def dot_escape(s): + # kinda paranoid, should probably revise later + permitted=string.digits + string.letters + ' -<>-:,address@hidden&.+_~?/' + return ''.join(filter(lambda x: x in permitted, s)) graph_id = "%s.%d" % (id, limit) rv = { 'dot_file' : os.path.join(graphdir, graph_id + ".dot"), @@ -150,18 +155,26 @@ return rv contents = "digraph ancestry {" contents += "edge [dir=back];\n" - revisions = sets.Set() + revisions = {} for attrs in self.ancestry(id, limit): if not attrs.has_key("Revision") or not attrs.has_key("Ancestor"): continue revision = attrs['Revision'][0] - revisions.add(revision) + revisions[revision] = attrs for ancestor in attrs['Ancestor']: if len(ancestor) == 0: continue - revisions.add(ancestor) + if not revisions.has_key(ancestor): revisions[ancestor] = None contents += '"%s"->"%s"\n' % (revision, ancestor) - for revision in revisions: - opts = 'fontsize=8,shape=box,href="revision.psp?id=%s"' % (urllib.quote(revision)) + for revision in revisions.keys(): + label = "%s" % (revision) + attrs = revisions[revision] + if attrs == None: + # fill in the gaps; would be nice to clean this up. + # shouldn't take long, anyway. + attrs = self.ancestry(revision, 1)[0] + if attrs.has_key('Author'): label += "\\n%s" % (dot_escape(attrs['Author'][0])) + if attrs.has_key('Date'): label += "\\n%s" % (dot_escape(attrs['Date'][0])) + opts = 'fontname=Windsor,fontsize=8,shape=box,href="revision.psp?id=%s",label="%s"' % (urllib.quote(revision), label) if revision == id: opts += ",color=blue" contents += '"%s" [%s]\n' % (revision, opts) contents += "}\n" ============================================================ --- revision.psp 7f933a135197c878bb614f4c25ab23f36f7073a5 +++ revision.psp 78f4a1f16fcaf297130c97fc812a57fde57762a8 @@ -1,7 +1,8 @@ <% import config import monotone +reload(monotone) import common import urllib import template