# # # patch "manifest.psp" # from [4a261914914a02b3bc5fdbf8b6ed6ff95e37fa8e] # to [5b0cebd3558b2f6734b07fe71062f125d4e2cea5] # ============================================================ --- manifest.psp 4a261914914a02b3bc5fdbf8b6ed6ff95e37fa8e +++ manifest.psp 5b0cebd3558b2f6734b07fe71062f125d4e2cea5 @@ -39,7 +39,7 @@ manifest = mt.manifest(manifest_id) info = { - 'title' : "/%s in revision %s" % (hq(path), hq(id)), + 'title' : "Dir '/%s' in revision %s" % (hq(path), hq(id)), } req.write(template.header(info)) %> @@ -82,6 +82,36 @@ elif len(parts) == depth + 1: files.append((parts[-1], file_id, filename)) +# hopefully this will eventually be less ugly +# +# we need to find out the revision in which each of the objects in +# 'files' was last touched. so iterate; get the certs for each ancestor +# of the current revision, until we have that information for every +# file in 'files' + +req.write('here: %s
' % id) +ancestors = mt.toposort(mt.ancestors([id])) +ancestors.append(id) +ancestors.reverse() # so we can iterate back through time.. +file_to_rev = {} + +for name, file_id, file in files: + file_to_rev[file] = None + +found = 0 +for ancestor in ancestors: + rev = mt.revision(ancestor) + for key in rev.keys(): + for stanza in rev[key]: + affected = None + type = stanza[0][0] + if type == "patch" or type == "add_file" or type == "delete_file" or type == "delete_dir": affected = stanza[0][1] + elif type == "rename_file" or type == "rename_dir": affected = stanza[1][1] + if affected != None and file_to_rev.has_key(affected) and file_to_rev[affected] == None: + file_to_rev[affected] = ancestor + found += 1 + if found >= len(files): break + if depth != 0: subdirs = [('..', '/'.join(sp[:-1]))] + subdirs # req.write("%s %s %s
" % (str(sp), str(parts), depth)) @@ -94,7 +124,13 @@ tr.write('%s' % (icon_uri, urllib.quote(id), urllib.quote(subdir), hq(name))) for name, file_id, file in files: icon_uri = get_icon(file) - tr.write('%s' % (icon_uri, link("file", [file_id, file], name))) + rev = file_to_rev.get(file, None) + if not rev: + tr.write('%s' % (icon_uri, link("file", [file_id, file], name))) + else: + tr.write('%s%s' % (icon_uri, \ + link("file", [file_id, file], name), \ + link("revision", rev))) tr.stop() %>