Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 47
- Log:
A few include paths in the syntax library were still wrong, at least for
the installation on Alpha. Some spurious white space changes to files in
the 'app' tree. Fixes bug described by Ticket #37.
- Author:
- adh
- Date:
- Wed Aug 02 21:45:12 +0100 2006
- Size:
- 2490 Bytes
1 | class RepositoryController < ApplicationController |
2 | before_filter :login_required |
3 | layout 'application', :except => ['send_data_to_browser'] |
4 | |
5 | def index |
6 | redirect_to :action => 'browse' |
7 | end |
8 | |
9 | def browse |
10 | path = params[:path].to_s |
11 | @rev = params[:rev] |
12 | if Repository.is_dir?(path) |
13 | @current_entry = Repository.get_node_entry(path, @rev) |
14 | @node_entries = @current_entry.entries#Repository.get_node_entries(path, @rev) |
15 | @node_entries.sort!{ |x,y| x.name.downcase <=> y.name.downcase } |
16 | @node_entries.sort!{ |x,y| x.type <=> y.type } |
17 | GC.start |
18 | else |
19 | redirect_to :action => 'view_file', :path => params[:path] |
20 | end |
21 | end |
22 | |
23 | # TODO: check so that filesize is reasonable, before doing anything |
24 | def view_file |
25 | path = params[:path].to_s |
26 | @rev = params[:rev] |
27 | if Repository.is_dir?(path) |
28 | redirect_to :action => 'browse', :path => params[:path] |
29 | else |
30 | @file = Repository.get_node_entry(path, @rev) |
31 | if params[:format] == 'raw' |
32 | send_data @file.contents, :name => path |
33 | elsif @params[:format] == 'txt' |
34 | send_data @file.contents, :type => "text/plain", :disposition => 'inline' |
35 | else |
36 | if @file.is_textual? |
37 | render :action => 'showfile' |
38 | elsif @file.is_image? |
39 | render :action => 'showimage' |
40 | else |
41 | render :action => 'showunknown' |
42 | end |
43 | end |
44 | end |
45 | end |
46 | |
47 | def changesets |
48 | @changeset_pages, @changesets = |
49 | paginate :changesets, :order_by => 'revision DESC', :per_page => 15 |
50 | end |
51 | |
52 | def show_changeset |
53 | @changeset = Changeset.find_by_revision(params[:revision]) |
54 | |
55 | if @changeset.nil? |
56 | redirect_to :action => 'changesets' |
57 | else |
58 | @files_to_diff = @changeset.changes.reject {|change| change.name != 'M' } |
59 | @files_to_diff.reject! {|f| !f.diffable? } |
60 | end |
61 | end |
62 | |
63 | def revisions |
64 | path = params[:path].to_s |
65 | logger.debug "** PATH: #{path}" |
66 | redirect_to :action => 'browse' if path.empty? |
67 | @changes = Change.find_all_by_path(path, :order => 'created_at DESC', :include => :changeset) |
68 | end |
69 | |
70 | def send_data_to_browser |
71 | path = params['path'].to_s |
72 | @rev = params[:rev] |
73 | file = Repository.get_node_entry(path, @rev) |
74 | send_data file.contents, :type => file.mime_type, :disposition => 'inline' |
75 | end |
76 | |
77 | private |
78 | def authorize?(user) |
79 | if %w'changesets show_changeset'.include?(action_name) |
80 | user.view_changesets? |
81 | else |
82 | user.view_code? |
83 | end |
84 | end |
85 | end |