Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 434
- Log:
Fix breakage of graphical revisions by character set conversion of
all data from the CVS viewer script; just parse text/* types.Switch from forced HTTP fetching of related resources to forced
HTTPS fetching, with certificate chain support.
- Author:
- rool
- Date:
- Fri Aug 30 03:16:00 +0100 2013
- Size:
- 3876 Bytes
1 | require 'revision_parser' |
2 | |
3 | class RevisionsController < ApplicationController |
4 | |
5 | def list |
6 | # Use cvslog2web output directly for a list of recent changes. |
7 | |
8 | render :file => "#{CVSLOG2WEB_OUTPUT}/recent.html", :layout => 'default' |
9 | end |
10 | |
11 | def logs |
12 | # Use cvslog2web output directly for log details of a specific change. |
13 | # Links are based off an 'ident' parameter pulled in via a query string; |
14 | # we don't want people putting in "../" etc. to try and navigate around |
15 | # the server, so strip out ".", "\" and "/". |
16 | |
17 | log = "#{params[:ident]}" |
18 | log.gsub!(/\.html$/, '') |
19 | log.gsub!(/[\.\/\\]/, '') |
20 | |
21 | render :file => "#{CVSLOG2WEB_OUTPUT}/#{log}.html", :layout => 'default' |
22 | end |
23 | |
24 | def revisions |
25 | # Create a revision parser for a CVSHistory RSS feed. Get a |
26 | # hash keyed by revision number (as a string), each entry |
27 | # containing an array of RevisionDetails objects. Sort the |
28 | # revision keys in reverse order of associated date (i.e. most |
29 | # recent first) and iterate through the resulting sorted list. |
30 | |
31 | parser = RevisionParser.new(get_parser_url()) |
32 | revisions = parser.fetch_and_parse(true) |
33 | sort_keys = revisions.keys.sort do |key_x, key_y| |
34 | revisions[key_y][0][:date] <=> revisions[key_x][0][:date] |
35 | end |
36 | |
37 | # Create an array of items in sorted order. |
38 | |
39 | @output = [] |
40 | |
41 | sort_keys.each do |revision| |
42 | |
43 | # For each revision we have an array of changed files. For the overall |
44 | # item details, choose (arbitrarily) the first one - 'item' should only |
45 | # be looked at in terms of the attributes it has which apply equally to |
46 | # all files in this revision. Make sure we note the key name that was |
47 | # used for this item within the item itself. |
48 | |
49 | item = revisions[revision][0] |
50 | item[:key] = revision |
51 | |
52 | @output.push(item) |
53 | end |
54 | |
55 | # Render the default layout to create the revision list. |
56 | |
57 | render :layout => 'default' |
58 | end |
59 | |
60 | def show |
61 | # The 'list' action creates links that create a parameter 'ident' in the |
62 | # @params hash. This is a key to a revision hash entry. Extract the relevant |
63 | # hash and pass it to the view. |
64 | |
65 | parser = RevisionParser.new(get_parser_url()) |
66 | revisions = parser.fetch_and_parse(true) |
67 | @output = revisions[@params[:ident]] |
68 | |
69 | # Sort the array of revised files by category of action then by path. |
70 | |
71 | @output.sort do |x,y| |
72 | x[:category] <=> y[:category] |
73 | end.sort do |x,y| |
74 | x[:path] <=> y[:path] |
75 | end |
76 | |
77 | # Create mappings between categories and Collaboa icons plus suffix text. |
78 | # |
79 | # TO DO: Move these icons to the shared pool and update Collaboa accordingly. |
80 | |
81 | @category_map = { |
82 | 'Addition' => { :image => '/tracker/images/chg-icon_A.png', :text => '(+)' }, |
83 | 'Removal' => { :image => '/tracker/images/chg-icon_D.png', :text => '(-)' }, |
84 | 'Commit' => { :image => '/tracker/images/chg-icon_M.png', :text => '' }, |
85 | :unknown => { :image => '/tracker/images/icon_file.gif', :text => '?' } |
86 | } |
87 | |
88 | render :layout => 'default' |
89 | end |
90 | |
91 | # Synthesised revisions: return the CVS History feed URL. |
92 | |
93 | def get_parser_url |
94 | |
95 | # For sites that hold a development service on usual port numbers, |
96 | # check to see if we're using the development HTTP port. If so, |
97 | # change to the development HTTPS port. Then check to see if we're |
98 | # on the development HTTPS port; if not, change to port 443 for a |
99 | # regular HTTPS service. |
100 | |
101 | port = request.env['SERVER_PORT'] |
102 | port = DEVEL_HTTPS_PORT if (port == DEVEL_HTTP_PORT) |
103 | port = 443 if (port != DEVEL_HTTPS_PORT) |
104 | |
105 | "https://#{request.host}:#{port}#{CVSLOG2WEB_PREFIX}" + |
106 | '?revsel1=na&revsel2=na&datesel1=na&datesel2=na&selop=in&opA=on&opM=on&opR=on&opT=on&limit=1&rss=1' |
107 | end |
108 | end |