# # # patch ".htaccess" # from [e3915658cb464d05f21332e03d30dca5d94fe776] # to [131caf178bf6641ecfa4333264574f1cd6ed41cd] # # patch "ChangeLog" # from [fc74a48c7f73eedcbe1ea709755fbe819b29736c] # to [bf22eb8a403f38ef8fe67d90a03ffada0102cf51] # # patch "config.py.example" # from [64cb5898e3a026b4782c343ca4386585e0c3c275] # to [cea81e6b0532bfda1a3f93c91c9db63e4ad8755b] # # patch "fileinbranch.psp" # from [5d8536100fdf51d505b6f20bc9c16aa78d4e86a8] # to [f3f362cf9de2f302ab6fbcbea1ca04ae72d8e20e] # # patch "html.py" # from [18a8bffc8729d7bfd71d2e0cb35a1aed1854fa74] # to [6121f3a3831136e182b9e1b9df342231675839dc] # # patch "monotone.py" # from [708b61436dce59f47bd07397ce96a1cfabe81970] # to [04e570747e50d80629f0f191fd01b641f203bcad] # # patch "revision.psp" # from [a02b1c161006840ea8685e461fd07f0e9bb145a3] # to [51091c49bd6c1907ceb6ed43676742b2fbebc4d8] # ============================================================ --- .htaccess e3915658cb464d05f21332e03d30dca5d94fe776 +++ .htaccess 131caf178bf6641ecfa4333264574f1cd6ed41cd @@ -1,4 +1,5 @@ AddHandler mod_python .psp +Options FollowSymLinks PythonHandler wrapper PythonInterpreter viewmtn AddHandler mod_python .py ============================================================ --- ChangeLog fc74a48c7f73eedcbe1ea709755fbe819b29736c +++ ChangeLog bf22eb8a403f38ef8fe67d90a03ffada0102cf51 @@ -1,3 +1,6 @@ + +Nice patch from mrb to link patches along graph edges + 2005-05-21 Grahame Bowland * release 0.03 ============================================================ --- config.py.example 64cb5898e3a026b4782c343ca4386585e0c3c275 +++ config.py.example cea81e6b0532bfda1a3f93c91c9db63e4ad8755b @@ -29,6 +29,9 @@ # a good idea not to leave your private key in it dbfile = '/path/to/monotone.db' +# where to find GNOME icons (used in manifest listing) +gnome_icon_path = '/path/to/share/icons/gnome/' + graphopts = { # a directory (must be writable by the web user) # in which viewmtn can output graph files ============================================================ --- fileinbranch.psp 5d8536100fdf51d505b6f20bc9c16aa78d4e86a8 +++ fileinbranch.psp f3f362cf9de2f302ab6fbcbea1ca04ae72d8e20e @@ -1,6 +1,5 @@ <% -import config import monotone import common import urllib ============================================================ --- html.py 18a8bffc8729d7bfd71d2e0cb35a1aed1854fa74 +++ html.py 6121f3a3831136e182b9e1b9df342231675839dc @@ -1,11 +1,25 @@ +import mimetypes import urllib import common +import config import time +import os from viewmtn import release hq = common.html_escape() +def get_icon(filename, mime_type=None): + if mime_type == None: + mime_type = mimetypes.guess_type(filename)[0] + if not mime_type: + mime_type = "text" + icon = 'gnome-mime-' + mime_type.replace('/', '-') + '.png' + if os.access(os.path.join(config.gnome_mimetype_icon_path, icon), os.R_OK): + return icon + else: + return None + class Template: def header(self, info): if not info.has_key("title"): info['title'] = "untitled" ============================================================ --- monotone.py 708b61436dce59f47bd07397ce96a1cfabe81970 +++ monotone.py 04e570747e50d80629f0f191fd01b641f203bcad @@ -177,9 +177,12 @@ else: return filter(None, result.split('\n')) def revision(self, id): + error, result = self.automate.run('get_revision', [id]) + if error != 0: + raise Exception("Unable to get revision: %s" % id) rv = {} cv = [] - for line in utility.iter_command(self.base_command + " cat revision %s" % (pipes.quote(id))): + for line in result.split('\n'): if not line: if len(cv) != 0: stanza_type = cv[0][0] @@ -192,18 +195,21 @@ cv.append(m.groups()) return rv def manifest(self, id): + error, result = self.automate.run('get_manifest', [id]) + if error != 0: + raise Exception("Unable to get manifest: %s" % id) rv = [] - for line in utility.iter_command(self.base_command + " cat manifest %s" % (pipes.quote(id))): + for line in result.split('\n'): m = manifest_entry_re.match(line) if not m: continue rv.append(m.groups()) return rv def file(self, id): - result = utility.run_command(self.base_command + " cat file %s" % (pipes.quote(id))) - if result['exitcode'] != 0: - raise Exception("Unable to retrieve file: %s" % (result['childerr'])) + error, result = self.automate.run('get_file', [id]) + if error != 0: + raise Exception("Unable to get file: %s" % id) else: - return result['fromchild'] + return result def annotate(self, id, file): result = utility.run_command(self.base_command + " annotate --revision=%s %s" % (pipes.quote(id), pipes.quote(file))) @@ -215,6 +221,8 @@ def diff(self, rev_from, rev_to, files=None): command = self.base_command + " diff -r %s -r %s" % (pipes.quote(rev_from), pipes.quote(rev_to)) if files != None: command += ' ' + ' '.join(map(pipes.quote, files)) + import syslog + syslog.syslog(command) result = utility.run_command(command) if result['exitcode'] != 0: raise Exception("Unable to calculate diff: %s" % (result['childerr'])) @@ -264,7 +272,7 @@ if len(missing) == 0: rv['cached'] = True return rv - contents = "digraph ancestry {\nratio=compress\nnodesep=0.1\nranksep=0.2\nedge [dir=back];\n" + contents = 'digraph ancestry {\nratio=compress\nnodesep=0.1\nranksep=0.2\nedge [dir=back];\n' revisions = {} for attrs in self.log([id], limit): if not attrs.has_key("Revision") or not attrs.has_key("Ancestor"): @@ -274,7 +282,7 @@ for ancestor in attrs['Ancestor']: if len(ancestor) == 0: continue if not revisions.has_key(ancestor): revisions[ancestor] = None - contents += '"%s"->"%s"\n' % (revision, ancestor) + contents += '"%s"->"%s"[href="getdiff.py?id1=%s&id2=%s"]\n' % (urllib.quote(revision), urllib.quote(ancestor), urllib.quote(ancestor), urllib.quote(revision)) for revision in revisions.keys(): label = "%s..." % (revision[0:8]) attrs = revisions[revision] ============================================================ --- revision.psp a02b1c161006840ea8685e461fd07f0e9bb145a3 +++ revision.psp 51091c49bd6c1907ceb6ed43676742b2fbebc4d8 @@ -5,6 +5,7 @@ import common import urllib from common import link +from html import get_icon # # revision.psp @@ -164,6 +165,8 @@ if spillage > 0 and i < spillage: size += 1 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('\n') offset += size