# # # rename "templates/revisionfile.html" # to "templates/revisionfileview.html" # # add_file "templates/revisionfile.html" # content [f65756e6b62d7ff2fa7cae7fbc2a0fc82933eb9b] # # add_file "templates/revisionfilechanges.html" # content [3aa8f7f29d9abe66a15aa62b67469f4fa7c8100d] # # patch "templates/base.html" # from [d91e420efdc71dfd514a1514ee751b4a616697b5] # to [1be9c3a8bbe40d46dcd5bc6507b2547233c659dc] # # patch "templates/revisionfilebin.html" # from [ed073e34de5e16ad7ed0d14ce01bff80b0d78970] # to [58a6080633337480f0f620eeece57059fc50a532] # # patch "templates/revisionfileimg.html" # from [cd246dd75333b2ced5d8dd9216e0d50a16769dfd] # to [e9c685b6125b311189fb05e0f867326978d5189a] # # patch "templates/revisionfileobj.html" # from [aecf0edca364646c23f9fecfb764159a73b4d7d1] # to [01c532aadbb1782abcf1b30bc6c60ceaa06e6c00] # # patch "templates/revisionfiletxt.html" # from [c15b907d1bf28ed74a6835cb5dc775241432e958] # to [56c9ac35eb9160347e72c68064d102a9bf02a6f6] # # patch "templates/revisionfileview.html" # from [8d316cefa1d01ec52d0e42a923a7736a46efda0d] # to [5a5591e812fdf877cf4c3daa3a14c5eb9b210a0d] # # patch "viewmtn.py" # from [f175d4989b3a34435d6f5df3ce800b020a29a13d] # to [edc46b7a0d6c5f24e5770aaac4db304dcce8a235] # ============================================================ --- templates/revisionfile.html f65756e6b62d7ff2fa7cae7fbc2a0fc82933eb9b +++ templates/revisionfile.html f65756e6b62d7ff2fa7cae7fbc2a0fc82933eb9b @@ -0,0 +1,10 @@ +#extends revision + +#def extramenu1 +File $filename.name: +#filter Filter +$link($filename, for_changes=True).html(override_description="Changes") | +$link($filename).html(override_description="View") | +$link($filename, for_download=True).html(override_description="Download") +#filter WebSafe +#end def ============================================================ --- templates/revisionfilechanges.html 3aa8f7f29d9abe66a15aa62b67469f4fa7c8100d +++ templates/revisionfilechanges.html 3aa8f7f29d9abe66a15aa62b67469f4fa7c8100d @@ -0,0 +1,50 @@ +#extends revisionfile + +#def body + +

+Revisions $from_change to $to_change in in which '$filename.name' was +changed are listed below. These revisions were created after the +revision +#filter Filter +$link($revision).html() +#filter WebSafe +. The "diff" links listed with each revision will show changes +in '$filename.name' between that revision and +#filter Filter +$link($revision).html(). +#filter WebSafe +

+ + + +#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when in $display_revs + + + + + + + + + + + + +#end for +
+#filter Filter + $ago ago: $shortlog
+ + $link($revision).html("revision info") | + $link($revision, "browse").html("browse files") + $diffs + +#end filter +
Author:$author
Changelog: +#filter Filter +$changelog +#end filter +
Date:$when
+ +#end def ============================================================ --- templates/base.html d91e420efdc71dfd514a1514ee751b4a616697b5 +++ templates/base.html 1be9c3a8bbe40d46dcd5bc6507b2547233c659dc @@ -25,6 +25,8 @@ #block extramenu #end block +#block extramenu1 +#end block #block body ============================================================ --- templates/revisionfilebin.html ed073e34de5e16ad7ed0d14ce01bff80b0d78970 +++ templates/revisionfilebin.html 58a6080633337480f0f620eeece57059fc50a532 @@ -1,8 +1,8 @@ #extends revisionfile #def filecontents

-Unfortunately, this ViewMTN has determined that this file (with +Unfortunately, ViewMTN has determined that this file (with MIME type $mimetype) is not suitable for display inside the web browser. If you feel this file could have been better displayed please inform the author. ============================================================ --- templates/revisionfileimg.html cd246dd75333b2ced5d8dd9216e0d50a16769dfd +++ templates/revisionfileimg.html e9c685b6125b311189fb05e0f867326978d5189a @@ -1,4 +1,4 @@ -#extends revisionfile +#extends revisionfileview #def filecontents ============================================================ --- templates/revisionfileobj.html aecf0edca364646c23f9fecfb764159a73b4d7d1 +++ templates/revisionfileobj.html 01c532aadbb1782abcf1b30bc6c60ceaa06e6c00 @@ -1,4 +1,4 @@ -#extends revisionfile +#extends revisionfileview #def filecontents ============================================================ --- templates/revisionfile.html 8d316cefa1d01ec52d0e42a923a7736a46efda0d +++ templates/revisionfileview.html 5a5591e812fdf877cf4c3daa3a14c5eb9b210a0d @@ -1,4 +1,4 @@ -#extends revision +#extends revisionfile #def body ============================================================ --- viewmtn.py f175d4989b3a34435d6f5df3ce800b020a29a13d +++ viewmtn.py edc46b7a0d6c5f24e5770aaac4db304dcce8a235 @@ -188,6 +188,8 @@ class FileLink(Link): Link.__init__(*(self, ), **kwargs) if kwargs.has_key('for_download'): access_method = 'downloadfile' + elif kwargs.has_key('for_changes'): + access_method = 'filechanges' else: access_method = 'file' self.relative_uri = 'revision/' + access_method + '/' + file.in_revision + '/' + urllib.quote(file.name) @@ -311,14 +313,15 @@ class ComparisonRev: # there's only one thing in the list if not other: return 1 return cmp(other.date, self.date) - + class Renderer: def __init__(self): # any templates that can be inherited from, should be added to the list here self.templates = [ ('base.html', 'base'), ('revision.html', 'revision'), ('branch.html', 'branch'), - ('revisionfile.html', 'revisionfile') ] + ('revisionfile.html', 'revisionfile'), + ('revisionfileview.html', 'revisionfileview') ] self._templates_loaded = False # these variables will be available to any template @@ -444,7 +447,7 @@ class Changes: rv = True return rv - def for_template(self, revs): + def for_template(self, revs, path, constrain_diff_to=None): rv = [] for rev, certs in revs: rev_branch = "" @@ -465,10 +468,14 @@ class Changes: shortlog = quicklog(changelog) # so this is also HTML escaped. for stanza in ops.get_revision(rev): if stanza and stanza[0] == "old_revision": - old_revision = stanza[1] - diffs.append(Diff(mtn.Revision(old_revision), revision)) + if constrain_diff_to: + old_revision = constrain_diff_to + else: + old_revision = stanza[1] + diffs.append(Diff(mtn.Revision(old_revision), revision, path)) if diffs: - diffs = '| ' + ', '.join([link(d).html('diff') for d in diffs]) + if constrain_diff_to: diffs = [ diffs[0] ] + diffs = '| ' + ', '.join([link(d).html('diff') for d in diffs]) else: diffs = '' rv.append((revision, diffs, ago, mtn.Author(author), '
\n'.join(changelog), shortlog, when)) @@ -517,7 +524,7 @@ class Changes: previous_to=previous_to, next_from=next_from, next_to=next_to, - display_revs=self.for_template(changed)) + display_revs=self.for_template(changed, None)) def file_get_last_changes(self, from_change, to_change, revision, path): def content_changed_fn(in_revision): @@ -548,7 +555,7 @@ class Changes: previous_from, previous_to = None, None renderer.render(template_name, page_title="Changes to '%s' (from %s)" % (cgi.escape(path), revision.abbrev()), - path=path, + filename=mtn.File(path, revision), revision=revision, from_change=from_change, to_change=to_change, @@ -556,7 +563,7 @@ class Changes: previous_to=previous_to, next_from=next_from, next_to=next_to, - display_revs=self.for_template(changed)) + display_revs=self.for_template(changed, path, constrain_diff_to=revision)) class HTMLBranchChanges(Changes): def GET(self, branch, from_change, to_change):