# # # add_file "manifest.psp" # content [9244015efc03153b4837b17ac05570426213e9ad] # # patch "branch.psp" # from [b28ece354969314ce996f3030569215d685973d6] # to [b740d23aebd091993e5a367e7d183d5634cc718d] # # patch "common.py" # from [1fdb62e05fb2a9338d2c72ddc58de3ab2b3976fe] # to [1e086f49256b4f4372e6ce1cb9cc53cc5564c9d2] # # patch "fileinbranch.psp" # from [f3f362cf9de2f302ab6fbcbea1ca04ae72d8e20e] # to [66e47a474cb46610adc8117eaf45f7fa64d9e88b] # # patch "headofbranch.psp" # from [981df124a0b5655a9f78c42504cfa8c6f02b267a] # to [941f8cb85d9e1c05d5e1e9a7fe419e6c45bdaec3] # # patch "index.psp" # from [c621827db187839e1a7c6e51d5f1a7f6e0aa560c] # to [57d99c98f15d8761c2f8c1ca85b0aa5d959cb88d] # # patch "revision.psp" # from [51091c49bd6c1907ceb6ed43676742b2fbebc4d8] # to [9cb020164c77e5a2a33a798d418690d072bc1c3c] # # patch "tags.psp" # from [638140d6823eee5844de37d985773be75707fa25] # to [9b74bcccf9f006be39cf615e707cbb0d4c85ede4] # # patch "tarofbranch.psp" # from [be83f459a152ffd49d89d69555f870291bc85311] # to [99f001ed6a4855e6bbe97dbaca580fd6673bfae1] # # patch "wrapper.py" # from [530290467a99ca65f87b74f653bf462b28c6cda9] # to [93473bdf155244968461912404e4692899cdd3f2] # ============================================================ --- manifest.psp 9244015efc03153b4837b17ac05570426213e9ad +++ manifest.psp 9244015efc03153b4837b17ac05570426213e9ad @@ -0,0 +1,78 @@ + +<% + +import config +import monotone +import common +import urllib +from html import get_icon + +# +# manifest.psp +# display all information we can about a particular manifest +# + +def prettify(s): + return ' '.join(map(lambda x: hq(x[0].upper() + x[1:]), s.replace("_", " ").split(" "))) + +psp.set_error_page("error.psp") + +if not form.has_key('id'): + raise Exception("No revision ID specified.") + +id = form['id'] +if not monotone.is_valid_id(id): + raise Exception("Specified revision ID is not valid.") + +revision = mt.revision(id) +if not revision.has_key('new_manifest'): + raise Exception("There is no manifest in this revision ID.") +manifest_id = revision['new_manifest'][0][0][1] +manifest = mt.manifest(manifest_id) + +info = { + 'title' : "Manifest of revision %s" % (hq(id)), + } +req.write(template.header(info)) + +manifest = mt.manifest(manifest_id) + +%> + +

+For more information about this revision, see its page: <%= link("revision", id) %>. +below to view it. +

+ +

+All <%=len(manifest)%> files in this manifest can be downloaded together in a <%=link("tar", manifest_id, "tar archive")%>. +

+ +<% +# display the manifest broken into some columns. +n_columns = 3 +offset = 0 +req.write('') +for i in range(n_columns): + size = len(manifest) / n_columns; + spillage = len(manifest) % n_columns; + if spillage > 0 and i < spillage: size += 1 + req.write('\n') + offset += size +req.write('
\n') + for id, filename in manifest[offset:offset+size]: + icon = get_icon(filename) + if icon != None: req.write('' % icon) + req.write('%s
\n' % (link("file", [id, filename], filename))) + req.write('
') + +%> + + + +<% + +req.write(template.footer(info)) + +%> + ============================================================ --- branch.psp b28ece354969314ce996f3030569215d685973d6 +++ branch.psp b740d23aebd091993e5a367e7d183d5634cc718d @@ -1,10 +1,9 @@ <% import datetime import config import urllib import time -from common import link # # branch.psp ============================================================ --- common.py 1fdb62e05fb2a9338d2c72ddc58de3ab2b3976fe +++ common.py 1e086f49256b4f4372e6ce1cb9cc53cc5564c9d2 @@ -12,7 +12,7 @@ else: return e(x) -def link(link_type, link_to, description = None): +def link(mt, link_type, link_to, description = None): hq = html_escape() if link_type == "revision": rv = '' % (urllib.quote(link_to)) @@ -61,7 +61,12 @@ rv += '' return rv elif link_type == "manifest": - return '[' + hq(link_to[:8]) + '..]' + rv = '' % (urllib.quote(link_to)) + if description != None: rv += hq(description) + else: rv += hq(link_to[:8]) + ".." + rv += '' + if description == None: rv = '[' + rv + ']' + return rv else: rv = 'Unknown link type: %s' % (hq(link_type)) return rv ============================================================ --- fileinbranch.psp f3f362cf9de2f302ab6fbcbea1ca04ae72d8e20e +++ fileinbranch.psp 66e47a474cb46610adc8117eaf45f7fa64d9e88b @@ -1,9 +1,7 @@ <% import monotone -import common import urllib -from common import link psp.set_error_page("error.psp") ============================================================ --- headofbranch.psp 981df124a0b5655a9f78c42504cfa8c6f02b267a +++ headofbranch.psp 941f8cb85d9e1c05d5e1e9a7fe419e6c45bdaec3 @@ -1,7 +1,6 @@ <% import urllib -from common import link psp.set_error_page("error.psp") ============================================================ --- index.psp c621827db187839e1a7c6e51d5f1a7f6e0aa560c +++ index.psp 57d99c98f15d8761c2f8c1ca85b0aa5d959cb88d @@ -1,7 +1,6 @@ <% import common -from common import link psp.set_error_page("error.psp") info = { 'title' : "Branches" } ============================================================ --- revision.psp 51091c49bd6c1907ceb6ed43676742b2fbebc4d8 +++ revision.psp 9cb020164c77e5a2a33a798d418690d072bc1c3c @@ -1,11 +1,9 @@ <% import config import monotone import common import urllib -from common import link -from html import get_icon # # revision.psp @@ -58,12 +56,23 @@ ancestry_graph = mt.ancestry_graph(config.graphopts, id, ancestry_limit) req.write(open(ancestry_graph['imagemap_file']).read()) +revision = mt.revision(id) + %>
-

Files contained in this revision are listed under manifest.

+<% +if not revision.has_key('new_manifest'): +%> +

Note: no manifest is associated with this revision and hence it contains no files.

+<% +else: + # ugh, need to wrap things nicer + req.write('''

Files contained in this revision are listed in its %s.''' % (link("manifest", id, "manifest"))) +%> +

Certificates

@@ -74,7 +83,6 @@
<% -revision = mt.revision(id) old_revision = None for key in revision.keys(): value = "" @@ -89,10 +97,11 @@ value += 'Patch file %s from %s to %s (%s)
' % (hq(fname), link("file", [from_id, fname]), link("file", [to_id, fname]), link("diff", [old_revision, id, fname])) elif type == "old_revision": old_revision, old_manifest = stanza[0][1], stanza[1][1] - value += 'Old revision is: %s (%s)
Old manifest: %s
' % (link("revision", old_revision), link("diff", [old_revision, id]), link("manifest", old_manifest)) + value += 'Old revision is: %s (%s)
Old manifest: %s
' % (link("revision", old_revision), link("diff", [old_revision, id]), link("manifest", old_revision)) elif type == "new_manifest": + # swallow this, it's not useful new_manifest = stanza[0][1] - value += 'New manifest is: %s
' % (link("manifest", old_manifest)) + value += 'New manifest is: %s
' % (link("manifest", id)) elif type == "add_file": new_file = stanza[0][1] value += "Add file: %s
" % (hq(new_file)) @@ -133,47 +142,6 @@ - -
- - -

Manifest

- -<% -if not revision.has_key('new_manifest'): -%> -

No manifest is associated with this revision.

-<% -else: - # ugh, need to wrap things nicer - manifest_id = revision['new_manifest'][0][0][1] - manifest = mt.manifest(manifest_id) -%> - -

-All <%=len(manifest)%> files in this manifest can be downloaded together in a <%=link("tar", manifest_id, "tar archive")%>. -

- -<% - # display the manifest broken into some columns. - n_columns = 3 - offset = 0 - req.write('
') - for i in range(n_columns): - size = len(manifest) / n_columns; - spillage = len(manifest) % n_columns; - if spillage > 0 and i < spillage: size += 1 - req.write('\n') - offset += size - req.write('
\n') - for id, filename in manifest[offset:offset+size]: - icon = get_icon(filename) - if icon != None: req.write('' % icon) - req.write('%s
\n' % (link("file", [id, filename], filename))) - req.write('
') - -%> -
<% ============================================================ --- tags.psp 638140d6823eee5844de37d985773be75707fa25 +++ tags.psp 9b74bcccf9f006be39cf615e707cbb0d4c85ede4 @@ -1,7 +1,5 @@ <% -from common import link - psp.set_error_page("error.psp") info = { 'title' : "Tags" } req.write(template.header(info)) ============================================================ --- tarofbranch.psp be83f459a152ffd49d89d69555f870291bc85311 +++ tarofbranch.psp 99f001ed6a4855e6bbe97dbaca580fd6673bfae1 @@ -1,7 +1,6 @@ <% import urllib -from common import link psp.set_error_page("error.psp") ============================================================ --- wrapper.py 530290467a99ca65f87b74f653bf462b28c6cda9 +++ wrapper.py 93473bdf155244968461912404e4692899cdd3f2 @@ -120,8 +120,12 @@ try: if uri.endswith('.psp') and sane_uri_re.match(uri[:-4]): req.content_type = "text/html" + mt = Monotone(config.monotone, config.dbfile) + def our_link (link_type, link_to, description=None): + return common.link(mt, link_type, link_to, description) vars = { - 'mt' : Monotone(config.monotone, config.dbfile), + 'mt' : mt, + 'link' : our_link, 'hq' : common.html_escape(), 'template' : Template() }