# # # add_file "templates/revisionfilechangesrss.html" # content [efb2657f8b97af62a879ef709af48a1702edb135] # # patch "ChangeLog" # from [cacdd36e12c698cf754247fae7eff24ac5e7fc30] # to [f7eb8731b92a7df893d827078b5e282b714ea386] # # patch "mtn.py" # from [219dcc3089d7a5cdaf9b4be6d27992208f3100c9] # to [24bdc6cf0f2935b5768da503135c11c50f86e267] # # patch "templates/branchchanges.html" # from [84dfe05fe66d988e3cdf426da5e0b339ed5d2df2] # to [26a4a466df7417985215c652b46b476134a11ad9] # # patch "templates/branchchangesrss.html" # from [46271c2dacb94ed9127e12c9c5f5e71333e68f9d] # to [bfbbfead32d6e0aad40646932be79348f2aba0af] # # patch "templates/revisionfile.html" # from [f65756e6b62d7ff2fa7cae7fbc2a0fc82933eb9b] # to [a464e4081820e2851791b2969c5ade8ed7e9f4b7] # # patch "templates/revisionfilechanges.html" # from [3aa8f7f29d9abe66a15aa62b67469f4fa7c8100d] # to [9aa1d3367d46c3f119250f153fa1f4f0d66a1269] # # patch "viewmtn.py" # from [edc46b7a0d6c5f24e5770aaac4db304dcce8a235] # to [0071746f40c249e34f72d46fecde38f9d8cae948] # ============================================================ --- templates/revisionfilechangesrss.html efb2657f8b97af62a879ef709af48a1702edb135 +++ templates/revisionfilechangesrss.html efb2657f8b97af62a879ef709af48a1702edb135 @@ -0,0 +1,22 @@ + + + en-us + + Changes to file $filename.name (from $revision.abbrev()) + $link($filename, for_changes=True).uri() + Changes to file $filename.name (from $revision.abbrev()) + +#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when, $verfilename in $display_revs + +#filter Filter + $link($revision).uri() + $shortlog + $changelog +#end filter + $author + $when + +#end for + + + ============================================================ --- ChangeLog cacdd36e12c698cf754247fae7eff24ac5e7fc30 +++ ChangeLog f7eb8731b92a7df893d827078b5e282b714ea386 @@ -1,3 +1,11 @@ +2007-04-11 Grahame Bowland + + * beta of file-based changelogs + * NB: RSS feeds are misleading, as the information + in the RSS feed is immutable. A TODO here is to + make the RSS feed URI bounce off the to-head proxy + method. + 2007-04-09 Grahame Bowland * put an explanation of the revision graph on ============================================================ --- mtn.py 219dcc3089d7a5cdaf9b4be6d27992208f3100c9 +++ mtn.py 24bdc6cf0f2935b5768da503135c11c50f86e267 @@ -44,7 +44,7 @@ class Revision(str): str.__init__(v) self.obj_type = "revision" if v != '' and not (revision_re_c.match(self) and len(self) == sha1_len): - raise MonotoneException("Not a valid revision ID: %s" % (v)) + raise MonotoneException("Not a valid revision ID: %s" % (repr(v))) def abbrev(self): return '[' + self[:8] + '..]' ============================================================ --- templates/branchchanges.html 84dfe05fe66d988e3cdf426da5e0b339ed5d2df2 +++ templates/branchchanges.html 26a4a466df7417985215c652b46b476134a11ad9 @@ -8,7 +8,7 @@ Changes $from_change to $to_change on th -#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when in $display_revs +#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when, $filename in $display_revs
#filter Filter $ago ago: $shortlog
============================================================ --- templates/branchchangesrss.html 46271c2dacb94ed9127e12c9c5f5e71333e68f9d +++ templates/branchchangesrss.html bfbbfead32d6e0aad40646932be79348f2aba0af @@ -7,7 +7,7 @@ Changes to branch $branch.name -#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when in $display_revs +#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when, $verfilename in $display_revs #filter Filter $link($revision).uri() ============================================================ --- templates/revisionfile.html f65756e6b62d7ff2fa7cae7fbc2a0fc82933eb9b +++ templates/revisionfile.html a464e4081820e2851791b2969c5ade8ed7e9f4b7 @@ -5,6 +5,7 @@ $link($filename).html(override_descripti #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") +$link($filename, for_download=True).html(override_description="Download") | +$link($filename, for_changes_rss=True).html(override_description="RSS") #filter WebSafe #end def ============================================================ --- templates/revisionfilechanges.html 3aa8f7f29d9abe66a15aa62b67469f4fa7c8100d +++ templates/revisionfilechanges.html 9aa1d3367d46c3f119250f153fa1f4f0d66a1269 @@ -1,15 +1,15 @@ Revisions $from_change to $to_change in #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 +changed are listed below. These revisions are ancestors of the revision #filter Filter -$link($revision).html() +$link($revision).html(). #filter WebSafe -. The "diff" links listed with each revision will show changes +The "diff" links listed with each revision will show changes in '$filename.name' between that revision and #filter Filter $link($revision).html(). @@ -18,14 +18,15 @@ $link($revision).html(). -#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when in $display_revs +#for $revision, $diffs, $ago, $author, $changelog, $shortlog, $when, $verfilename in $display_revs ============================================================ --- viewmtn.py edc46b7a0d6c5f24e5770aaac4db304dcce8a235 +++ viewmtn.py 0071746f40c249e34f72d46fecde38f9d8cae948 @@ -190,6 +190,8 @@ class FileLink(Link): access_method = 'downloadfile' elif kwargs.has_key('for_changes'): access_method = 'filechanges' + elif kwargs.has_key('for_changes_rss'): + access_method = 'filechanges/rss' else: access_method = 'file' self.relative_uri = 'revision/' + access_method + '/' + file.in_revision + '/' + urllib.quote(file.name) @@ -447,7 +449,7 @@ class Changes: rv = True return rv - def for_template(self, revs, path, constrain_diff_to=None): + def for_template(self, revs, pathinfo=None, constrain_diff_to=None): rv = [] for rev, certs in revs: rev_branch = "" @@ -466,19 +468,23 @@ class Changes: elif cert[5] == 'changelog': changelog = normalise_changelog(cert[7]) # NB: this HTML escapes! shortlog = quicklog(changelog) # so this is also HTML escaped. + if pathinfo != None: + filename = pathinfo.get(rev) + else: + filename = None + if constrain_diff_to: + diff_to_revision = mtn.Revision(constrain_diff_to) + else: + diff_to_revision = revision for stanza in ops.get_revision(rev): if stanza and stanza[0] == "old_revision": - if constrain_diff_to: - old_revision = constrain_diff_to - else: - old_revision = stanza[1] - diffs.append(Diff(mtn.Revision(old_revision), revision, path)) + diffs.append(Diff(mtn.Revision(stanza[1]), diff_to_revision, filename)) if 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)) + rv.append((revision, diffs, ago, mtn.Author(author), '
\n'.join(changelog), shortlog, when, mtn.File(filename, rev))) return rv def determine_bounds(self, from_change, to_change): @@ -524,30 +530,36 @@ class Changes: previous_to=previous_to, next_from=next_from, next_to=next_to, - display_revs=self.for_template(changed, None)) + display_revs=self.for_template(changed)) def file_get_last_changes(self, from_change, to_change, revision, path): - def content_changed_fn(in_revision): + def content_changed_fn(start_revision, start_path, in_revision, pathinfo): uniq = set() parents = map(None, ops.parents(in_revision)) for parent in parents: - stanza = map(None, ops.get_corresponding_path(revision, path, parent)) + stanza = map(None, ops.get_corresponding_path(start_revision, start_path, parent)) # file does not exist in this revision; skip! if not stanza: continue - stanza = map(None, ops.get_content_changed(parent, path)) - uniq.add(stanza[0][1]) + # follow the white rabbit + current_path = stanza[0][1] + stanza = map(None, ops.get_content_changed(parent, current_path)) + to_add = stanza[0][1] + uniq.add(to_add) + pathinfo[to_add] = current_path return list(uniq) - start_at = content_changed_fn(revision) # not just the starting revision! we might not have changed 'path' in the starting rev.. + pathinfo = {} + # not just the starting revision! we might not have changed 'path' in the starting rev.. + start_at = content_changed_fn(revision, path, revision, pathinfo) changed, new_starting_point = self.__get_last_changes(start_at, - content_changed_fn, + lambda r: content_changed_fn(revision, path, r, pathinfo), lambda r: True, to_change) - return changed, new_starting_point + return changed, new_starting_point, pathinfo def File_GET(self, from_change, to_change, revision, path, template_name): from_change, to_change, next_from, next_to, previous_from, previous_to = self.determine_bounds(from_change, to_change) - changed, new_starting_point = self.file_get_last_changes(from_change, to_change, revision, path) + changed, new_starting_point, pathinfo = self.file_get_last_changes(from_change, to_change, revision, path) changed = changed[from_change:to_change] if len(changed) != to_change - from_change: next_from, next_to = None, None @@ -563,7 +575,7 @@ class Changes: previous_to=previous_to, next_from=next_from, next_to=next_to, - display_revs=self.for_template(changed, path, constrain_diff_to=revision)) + display_revs=self.for_template(changed, pathinfo=pathinfo, constrain_diff_to=revision)) class HTMLBranchChanges(Changes): def GET(self, branch, from_change, to_change): @@ -1175,7 +1187,8 @@ urls = ( r'/revision/file/('+mtn.revision_re+')/(.*)', 'RevisionFile', r'/revision/filechanges/()()('+mtn.revision_re+')/(.*)', 'RevisionFileChanges', r'/revision/filechanges/from/(\d+)/to/(\d+)/('+mtn.revision_re+')/(.*)', 'RevisionFileChanges', - r'/revision/filechanges/rss/('+mtn.revision_re+')/(.*)', 'RevisionFileChangesRSS', + r'/revision/filechanges/rss/()()('+mtn.revision_re+')/(.*)', 'RevisionFileChangesRSS', + r'/revision/filechanges/rss/from/(\d+)/to/(\d+)/('+mtn.revision_re+')/(.*)', 'RevisionFileChangesRSS', r'/revision/downloadfile/('+mtn.revision_re+')/(.*)', 'RevisionDownloadFile', r'/revision/info/('+mtn.revision_re+')', 'RevisionInfo', r'/revision/tar/('+mtn.revision_re+')', 'RevisionTar',
#filter Filter $ago ago: $shortlog
+ $link($verfilename).html(override_description="view file") + $diffs | $link($revision).html("revision info") | $link($revision, "browse").html("browse files") - $diffs #end filter