# # # patch "branch.psp" # from [dee26545ddf622a6929cdca3d57ecc994702c283] # to [3f275b89acfca31a858b3ad644a8576a0e6be7ca] # # patch "monotone.py" # from [af6a530e9a3782c715975ece4705dff54efc8f23] # to [583cd0001e5ac8fc7bf18987e313528d1630c229] # ============================================================ --- branch.psp dee26545ddf622a6929cdca3d57ecc994702c283 +++ branch.psp 3f275b89acfca31a858b3ad644a8576a0e6be7ca @@ -21,28 +21,28 @@ # # ok, what are we going to show to the user. -# we need a revision. if none has been provided, then we +# we need a id. if none has been provided, then we # look if there is a single HEAD. If so, display that. # Otherwise, display list of heads and offer the choice -# to choose them or another revision. +# to choose them or another id. # -revision = None -if not form.has_key('revision'): +id = None +if not form.has_key('id'): heads = mt.heads(branch) if len(heads) == 0: - raise Exception("No head revision can be determined for this branch.") + raise Exception("No head id can be determined for this branch.") elif len(heads) == 1: - revision = heads[0] + id = heads[0] else: %>

-The following head revisions are available. Please select one to view. +The following head ids are available. Please select one to view.

<% - for revision in heads: - req.write('%s
' % (urllib.quote(branch), urllib.quote(revision), hq(revision))) + for id in heads: + req.write('%s
' % (urllib.quote(branch), urllib.quote(id), hq(id))) else: - revision = form['revision'] + id = form['id'] hq = common.html_escape() info = {'title' : "Branch details for %s" % (hq(branch))} @@ -51,9 +51,12 @@ %>

-Viewing revision: <%=hq(revision)%> +Viewing id: <%=hq(id)%>

+<% +req.write("%s" % (mt.certs(id))) +%> <% req.write(footer(info)) ============================================================ --- monotone.py af6a530e9a3782c715975ece4705dff54efc8f23 +++ monotone.py 583cd0001e5ac8fc7bf18987e313528d1630c229 @@ -1,7 +1,17 @@ from goatpy import utility import pipes +import re +# +# a python wrapper for the "monotone" command +# +# should really use the "automate" interface as much as possible +# + +dash_re = re.compile(r'^-+$') +value_re = re.compile(r'^(\S*) *: (.*)$') + class Monotone: def __init__(self, mt, dbfile): self.mt = mt @@ -19,5 +29,27 @@ raise Exception("Unable to get list of heads: %s" (result['childerr'])) else: return filter(None, result['fromchild'].split('\n')) + def certs(self, id): + rv = [] + c_cert = None + c_key = c_value = None + for line in utility.iter_command(self.base_command + " ls certs %s" % (pipes.quote(id))): + if dash_re.match(line): + if c_cert: rv.append(c_cert) + c_cert = {} + elif c_cert != None: + m = value_re.match(line) + if m: + key, value = m.groups() + if key != '': + # then we don't have a continuation + if c_key != None: c_cert[c_key] = c_value + c_key, c_value = key, value + else: + c_value += '\n' + value + return rv + + +