# # # patch "branch.psp" # from [3f275b89acfca31a858b3ad644a8576a0e6be7ca] # to [153bc5ce2fd356eb91d3fda58695a875d6726d93] # ============================================================ --- branch.psp 3f275b89acfca31a858b3ad644a8576a0e6be7ca +++ branch.psp 153bc5ce2fd356eb91d3fda58695a875d6726d93 @@ -17,48 +17,35 @@ raise Exception("No branch specified.") branch = form['branch'] +# branch.psp +# +# we want to present the user with the HEAD +# id of this branch. +# +# if more than one HEAD exists, prompt the user +# and allow them to choose which one to view +# otherwise, redirect to id.psp and show that +# ID. + mt = Monotone(config.monotone, config.dbfile) -# -# ok, what are we going to show to the user. -# 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 id. -# -id = None -if not form.has_key('id'): - heads = mt.heads(branch) - if len(heads) == 0: - raise Exception("No head id can be determined for this branch.") - elif len(heads) == 1: - id = heads[0] - else: -%> -

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

-<% - for id in heads: - req.write('%s
' % (urllib.quote(branch), urllib.quote(id), hq(id))) +heads = mt.heads(branch) +if len(heads) == 0: + raise Exception("No head ID can be determined for this branch.") +elif len(heads) == 1: + # a single head ID; redirect to it + id = heads[0] + psp.redirect("id.psp?id=%s" % (urllib.quote(id))) else: - id = form['id'] - -hq = common.html_escape() -info = {'title' : "Branch details for %s" % (hq(branch))} -req.write(header(info)) - + hq = common.html_escape() + info = {'title' : "Branch details for %s" % (hq(branch))} + req.write(header(info)) %> -

-Viewing id: <%=hq(id)%> +The following head ids are available. Please select one to view.

- <% -req.write("%s" % (mt.certs(id))) -%> + for id in heads: + req.write('%s
' % (urllib.quote(id), hq(id))) -<% -req.write(footer(info)) %> -