Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 144
- Log:
Various updates, mostly concerned with integration with
cvslog2web for faster and more accurate log processing. The
synthesised revision summaries from CVSHistory remain though
the user is shown cvslog2web output by default. General layout
improvements included. Requires cvslog2web from Changeset #145
(which will be committed shortly; the checked out copies do
not sit in locations that make an atomic checkin easy and at
this stage atomicity is not that important).
- Author:
- adh
- Date:
- Tue Nov 14 22:39:20 +0000 2006
- Size:
- 3570 Bytes
1 | require 'revision_parser' |
2 | |
3 | class RevisionsController < ApplicationController |
4 | |
5 | # Synthesised revisions: CVS History feed URL |
6 | # |
7 | @@parser_url = 'http://pond.org.uk/python/cvshistory/cvshistory.cgi?revsel1=na&revsel2=na&datesel1=na&datesel2=na&selop=in&opA=on&opM=on&opR=on&opT=on&limit=1&rss=1' |
8 | |
9 | # cvslog2web output directory |
10 | # |
11 | @@cvslog2web_output = '/home/adh/python/cvslog2web/public' |
12 | |
13 | def list |
14 | # Use cvslog2web output directly for a list of recent changes. |
15 | |
16 | render :file => "#{@@cvslog2web_output}/recent.html", :layout => 'default' |
17 | end |
18 | |
19 | def logs |
20 | # Use cvslog2web output directly for log details of a specific change. |
21 | # Links are based off an 'ident' parameter pulled in via a query string; |
22 | # we don't want people putting in "../" etc. to try and navigate around |
23 | # the server, so strip out ".", "\" and "/". |
24 | |
25 | log = "#{params[:ident]}" |
26 | log.gsub!(/\.html$/, '') |
27 | log.gsub!(/[\.\/\\]/, '') |
28 | |
29 | logger.error("FETCH FILE: #{@@cvslog2web_output}/#{log}.html"); |
30 | |
31 | render :file => "#{@@cvslog2web_output}/#{log}.html", :layout => 'default' |
32 | end |
33 | |
34 | def revisions |
35 | # Create a revision parser for a CVSHistory RSS feed. Get a |
36 | # hash keyed by revision number (as a string), each entry |
37 | # containing an array of RevisionDetails objects. Sort the |
38 | # revision keys in reverse order of associated date (i.e. most |
39 | # recent first) and iterate through the resulting sorted list. |
40 | |
41 | parser = RevisionParser.new(@@parser_url) |
42 | revisions = parser.fetch_and_parse(true) |
43 | sort_keys = revisions.keys.sort do |key_x, key_y| |
44 | revisions[key_y][0][:date] <=> revisions[key_x][0][:date] |
45 | end |
46 | |
47 | # Create an array of items in sorted order. |
48 | |
49 | @output = [] |
50 | |
51 | sort_keys.each do |revision| |
52 | |
53 | # For each revision we have an array of changed files. For the overall |
54 | # item details, choose (arbitrarily) the first one - 'item' should only |
55 | # be looked at in terms of the attributes it has which apply equally to |
56 | # all files in this revision. Make sure we note the key name that was |
57 | # used for this item within the item itself. |
58 | |
59 | item = revisions[revision][0] |
60 | item[:key] = revision |
61 | |
62 | @output.push(item) |
63 | end |
64 | |
65 | # Render the default layout to create the revision list. |
66 | |
67 | render :layout => 'default' |
68 | end |
69 | |
70 | def show |
71 | # The 'list' action creates links that create a parameter 'ident' in the |
72 | # @params hash. This is a key to a revision hash entry. Extract the relevant |
73 | # hash and pass it to the view. |
74 | |
75 | parser = RevisionParser.new(@@parser_url) |
76 | revisions = parser.fetch_and_parse(true) |
77 | @output = revisions[@params[:ident]] |
78 | |
79 | # Sort the array of revised files by category of action then by path. |
80 | |
81 | @output.sort do |x,y| |
82 | x[:category] <=> y[:category] |
83 | end.sort do |x,y| |
84 | x[:path] <=> y[:path] |
85 | end |
86 | |
87 | # Create mappings between categories and Collaboa icons plus suffix text. |
88 | # |
89 | # TO DO: Move these icons to the shared pool and update Collaboa accordingly. |
90 | |
91 | @category_map = { |
92 | 'Addition' => { :image => '/rails/collaboa/images/chg-icon_A.png', :text => '(+)' }, |
93 | 'Removal' => { :image => '/rails/collaboa/images/chg-icon_D.png', :text => '(-)' }, |
94 | 'Commit' => { :image => '/rails/collaboa/images/chg-icon_M.png', :text => '' }, |
95 | :unknown => { :image => '/rails/collaboa/images/icon_file.gif', :text => '?' } |
96 | } |
97 | |
98 | render :layout => 'default' |
99 | end |
100 | end |