Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 85
- Log:
Extensive additions to support SVN-like collections revisions presented
in a similar manner to changesets under Collaboa. Integration with
"Ticket [#]xyz" text in check-in logs - generates links to Collboa tickets
if the text is spotted. Note that revision collation is a little slow and
not perfect; it works on directories, since revisions relate to paths and
unlike changesets are not repository-unique. See lib/revision_parser.rb
for more. Requires a CVShistory installation to function - future versions
might be smart enough to extract the information directly.
- Author:
- adh
- Date:
- Sun Oct 15 13:47:21 +0100 2006
- Size:
- 2716 Bytes
1 | require 'revision_parser' |
2 | |
3 | class RevisionsController < ApplicationController |
4 | |
5 | @@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' |
6 | |
7 | def list |
8 | # Create a revision parser for a CVSHistory RSS feed. Get a |
9 | # hash keyed by revision number (as a string), each entry |
10 | # containing an array of RevisionDetails objects. Sort the |
11 | # revision keys in reverse order of associated date (i.e. most |
12 | # recent first) and iterate through the resulting sorted list. |
13 | |
14 | parser = RevisionParser.new(@@parser_url) |
15 | revisions = parser.fetch_and_parse(true) |
16 | sort_keys = revisions.keys.sort do |key_x, key_y| |
17 | revisions[key_y][0][:date] <=> revisions[key_x][0][:date] |
18 | end |
19 | |
20 | # Create an array of items in sorted order. |
21 | |
22 | @output = [] |
23 | |
24 | sort_keys.each do |revision| |
25 | |
26 | # For each revision we have an array of changed files. For the overall |
27 | # item details, choose (arbitrarily) the first one - 'item' should only |
28 | # be looked at in terms of the attributes it has which apply equally to |
29 | # all files in this revision. Make sure we note the key name that was |
30 | # used for this item within the item itself. |
31 | |
32 | item = revisions[revision][0] |
33 | item[:key] = revision |
34 | |
35 | @output.push(item) |
36 | end |
37 | |
38 | # Render the default layout to create the revision list. |
39 | |
40 | render :layout => 'default' |
41 | end |
42 | |
43 | def show |
44 | # The 'list' action creates links that create a parameter 'ident' in the |
45 | # @params hash. This is a key to a revision hash entry. Extract the relevant |
46 | # hash and pass it to the view. |
47 | |
48 | parser = RevisionParser.new(@@parser_url) |
49 | revisions = parser.fetch_and_parse(true) |
50 | @output = revisions[@params[:ident]] |
51 | |
52 | # Sort the array of revised files by category of action then by path. |
53 | |
54 | @output.sort do |x,y| |
55 | x[:category] <=> y[:category] |
56 | end.sort do |x,y| |
57 | x[:path] <=> y[:path] |
58 | end |
59 | |
60 | # Create mappings between categories and Collaboa icons plus suffix text. |
61 | # |
62 | # TO DO: Move these icons to the shared pool and update Collaboa accordingly. |
63 | |
64 | @category_map = { |
65 | 'Addition' => { :image => '/rails/collaboa/images/chg-icon_A.png', :text => '(+)' }, |
66 | 'Removal' => { :image => '/rails/collaboa/images/chg-icon_D.png', :text => '(-)' }, |
67 | 'Commit' => { :image => '/rails/collaboa/images/chg-icon_M.png', :text => '' }, |
68 | :unknown => { :image => '/rails/collaboa/images/icon_file.gif', :text => '?' } |
69 | } |
70 | |
71 | render :layout => 'default' |
72 | end |
73 | end |