# # # patch "mtn.py" # from [e1715034ac1d310176d056eb90305a4c1c4b592f] # to [83c0839578662c078c8c109cea1c21446edb0cdb] # # patch "viewmtn.py" # from [ca57a6ddaff6efdd97228152e797eb8796c5f8fb] # to [728f0806a4a331836b9c67251c0534d37065b775] # ============================================================ --- mtn.py e1715034ac1d310176d056eb90305a4c1c4b592f +++ mtn.py 83c0839578662c078c8c109cea1c21446edb0cdb @@ -314,6 +314,14 @@ class Operations: for stanza in basic_io_from_stream(self.automate.run('get_revision', [revision])): yield stanza + def get_manifest_of(self, revision): + for stanza in basic_io_from_stream(self.automate.run('get_manifest_of', [revision])): + yield stanza + + def get_file(self, fileid): + for stanza in self.automate.run('get_file', [fileid]): + yield stanza + def certs(self, revision): for stanza in basic_io_from_stream(self.automate.run('certs', [revision])): yield stanza ============================================================ --- viewmtn.py ca57a6ddaff6efdd97228152e797eb8796c5f8fb +++ viewmtn.py 728f0806a4a331836b9c67251c0534d37065b775 @@ -257,8 +257,26 @@ class RevisionFile: class RevisionFile: def GET(self, revision, file): + def get_fileid(): + rv = None + for stanza in ops.get_manifest_of(revision): + if stanza[0] != 'file': + continue + if stanza[1] == file: + rv = stanza[3] + return rv + revision = mtn.Revision(revision) - print "file %s from revision %s" % (file, revision) + language = file.rsplit('.', 1)[-1] + fileid = get_fileid() + if not fileid: + return web.notfound() + contents = ops.get_file(fileid) + renderer.render('revisionfile.html', + file=file, + page_title="File %s in revision %s" % (file, revision.abbrev()), + revision=revision, + contents=syntax.highlight(contents, language)) class RevisionBrowse: def GET(self, revision, path):