# # # patch "mtn.py" # from [93ca32757dbb55233d8215aedfc6c155432f3d02] # to [c65916ab881226ab1ca6b4d44abbc5ccfa8badbd] # # patch "templates/branch.html" # from [3ef8e4e485dc9a825c4170667b11a7aa8e7c0927] # to [d55ee2a20704115844c44b79b2793a4e346999a9] # # patch "viewmtn.py" # from [f9cb4c0fbb900d3c767874318a9cc0028ab2d031] # to [e77b0ab87261e18f6f54cf23517f1ff9c246c7ab] # ============================================================ --- mtn.py 93ca32757dbb55233d8215aedfc6c155432f3d02 +++ mtn.py c65916ab881226ab1ca6b4d44abbc5ccfa8badbd @@ -331,6 +331,10 @@ class Operations: continue yield apply(Revision, (line,)) + def get_content_changed(self, revision, path): + for stanza in basic_io_from_stream(self.automate.run('get_content_changed', [revision, path])): + yield stanza + def get_revision(self, revision): for stanza in basic_io_from_stream(self.automate.run('get_revision', [revision])): yield stanza ============================================================ --- templates/branch.html 3ef8e4e485dc9a825c4170667b11a7aa8e7c0927 +++ templates/branch.html d55ee2a20704115844c44b79b2793a4e346999a9 @@ -1,9 +1,9 @@ #extends base #def extramenu Branch $branch.name: Changes | -Head revision +Head revision #end def #def rssheaders ============================================================ --- viewmtn.py f9cb4c0fbb900d3c767874318a9cc0028ab2d031 +++ viewmtn.py e77b0ab87261e18f6f54cf23517f1ff9c246c7ab @@ -189,6 +189,9 @@ def link(obj, link_type=None, **kwargs): link_class = type_to_link_class.get(obj.obj_type) if not link_class: raise LinkException("Unable to link to objects of type: '%s'" % (obj.obj_type)) + # ugh + if link_type: + kwargs['link_type'] = link_type return link_class(obj, **kwargs) class Renderer: @@ -372,7 +375,15 @@ class RSSBranchChanges(BranchChanges): def GET(self, branch, from_change, to_change): BranchChanges.GET(self, branch, from_change, to_change, "branchchangesrss.html") -class RevisionInfo: +class RevisionPage: + def branches_for_rev(self, revisions_val): + rv = [] + for stanza in ops.certs(revisions_val): + if stanza[4] == 'name' and stanza[5] == 'branch': + rv.append(stanza[7]) + return rv + +class RevisionInfo(RevisionPage): def GET(self, revision): revision = mtn.Revision(revision) certs = ops.certs(revision) @@ -383,7 +394,7 @@ class RevisionInfo: certs=certs_for_template(certs), revisions=revisions_for_template(revision, revisions)) -class RevisionDiff: +class RevisionDiff(RevisionPage): def GET(self, revision_from, revision_to, filename=None): revision_from = mtn.Revision(revision_from) revision_to = mtn.Revision(revision_to) @@ -400,7 +411,7 @@ class RevisionDiff: diff=syntax.highlight(diff, 'diff'), files=files) -class RevisionFile: +class RevisionFile(RevisionPage): def GET(self, revision, file): def get_fileid(): rv = None @@ -423,12 +434,26 @@ class RevisionFile: revision=revision, contents=syntax.highlight(contents, language)) -class RevisionBrowse: +class RevisionBrowse(RevisionPage): def GET(self, revision, path): revision = mtn.Revision(revision) - renderer.render('revisionpath.html', - page_title=revision, - path=path) + branches = RevisionPage.branches_for_rev(self, revision) + debug(branches) + revisions = ops.get_revision(revision) + page_title = "Browsing revision %s [%s]" % (revision.abbrev(), path or '') + if len(branches) > 0: + if len(branches) == 1: + branch_plural = 'branch' + else: + branch_plural = 'branches' + page_title += " of %s %s" % (branch_plural, ', '.join(branches)) + manifest = map(None, ops.get_manifest_of(revision)) + renderer.render('revisionbrowse.html', + branches=branches, + branch_links=', '.join(map(lambda b: link(mtn.Branch(b)).html(), branches)), + path=path, + page_title=page_title, + revision=revision) class RevisionTar: def GET(self, revision): @@ -448,6 +473,7 @@ urls = ( r'/json/(A-Za-z)/(.*)', 'Json', r'/revision/browse/('+mtn.revision_re+')/(.*)', 'RevisionBrowse', + r'/revision/browse/('+mtn.revision_re+')()', 'RevisionBrowse', r'/revision/diff/('+mtn.revision_re+')/with/('+mtn.revision_re+')', 'RevisionDiff', r'/revision/diff/('+mtn.revision_re+')/with/('+mtn.revision_re+')'+'/(.*)', 'RevisionDiff', r'/revision/file/('+mtn.revision_re+')/(.*)', 'RevisionFile',