@@ -167,7 +167,9 class Repository < ActiveRecord::Base | |||||
167 | end |
|
167 | end | |
168 |
|
168 | |||
169 | def entries(path=nil, identifier=nil) |
|
169 | def entries(path=nil, identifier=nil) | |
170 | scm.entries(path, identifier) |
|
170 | entries = scm.entries(path, identifier) | |
|
171 | load_entries_changesets(entries) | |||
|
172 | entries | |||
171 | end |
|
173 | end | |
172 |
|
174 | |||
173 | def branches |
|
175 | def branches | |
@@ -380,6 +382,16 class Repository < ActiveRecord::Base | |||||
380 | end |
|
382 | end | |
381 | end |
|
383 | end | |
382 |
|
384 | |||
|
385 | def load_entries_changesets(entries) | |||
|
386 | if entries | |||
|
387 | entries.each do |entry| | |||
|
388 | if entry.lastrev && entry.lastrev.identifier | |||
|
389 | entry.changeset = find_changeset_by_name(entry.lastrev.identifier) | |||
|
390 | end | |||
|
391 | end | |||
|
392 | end | |||
|
393 | end | |||
|
394 | ||||
383 | private |
|
395 | private | |
384 |
|
396 | |||
385 | # Deletes repository data |
|
397 | # Deletes repository data |
@@ -63,6 +63,8 class Repository::Bazaar < Repository | |||||
63 | end |
|
63 | end | |
64 | end |
|
64 | end | |
65 | end |
|
65 | end | |
|
66 | load_entries_changesets(entries) | |||
|
67 | entries | |||
66 | end |
|
68 | end | |
67 |
|
69 | |||
68 | def fetch_changesets |
|
70 | def fetch_changesets |
@@ -66,6 +66,7 class Repository::Cvs < Repository | |||||
66 | end |
|
66 | end | |
67 | end |
|
67 | end | |
68 | end |
|
68 | end | |
|
69 | load_entries_changesets(entries) | |||
69 | entries |
|
70 | entries | |
70 | end |
|
71 | end | |
71 |
|
72 |
@@ -66,6 +66,7 class Repository::Darcs < Repository | |||||
66 | end |
|
66 | end | |
67 | end |
|
67 | end | |
68 | end |
|
68 | end | |
|
69 | load_entries_changesets(entries) | |||
69 | entries |
|
70 | entries | |
70 | end |
|
71 | end | |
71 |
|
72 |
@@ -44,10 +44,6 class Repository::Filesystem < Repository | |||||
44 | false |
|
44 | false | |
45 | end |
|
45 | end | |
46 |
|
46 | |||
47 | def entries(path=nil, identifier=nil) |
|
|||
48 | scm.entries(path, identifier) |
|
|||
49 | end |
|
|||
50 |
|
||||
51 | def fetch_changesets |
|
47 | def fetch_changesets | |
52 | nil |
|
48 | nil | |
53 | end |
|
49 | end |
@@ -94,9 +94,9 class Repository::Git < Repository | |||||
94 | end |
|
94 | end | |
95 |
|
95 | |||
96 | def entries(path=nil, identifier=nil) |
|
96 | def entries(path=nil, identifier=nil) | |
97 | scm.entries(path, |
|
97 | entries = scm.entries(path, identifier, :report_last_commit => extra_report_last_commit) | |
98 | identifier, |
|
98 | load_entries_changesets(entries) | |
99 | options = {:report_last_commit => extra_report_last_commit}) |
|
99 | entries | |
100 | end |
|
100 | end | |
101 |
|
101 | |||
102 | # With SCMs that have a sequential commit numbering, |
|
102 | # With SCMs that have a sequential commit numbering, |
@@ -29,12 +29,11 | |||||
29 | :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> |
|
29 | :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> | |
30 | </td> |
|
30 | </td> | |
31 | <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td> |
|
31 | <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td> | |
32 | <% changeset = @repository.find_changeset_by_name(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %> |
|
|||
33 | <% if @repository.report_last_commit %> |
|
32 | <% if @repository.report_last_commit %> | |
34 | <td class="revision"><%= link_to_revision(changeset, @repository) if changeset %></td> |
|
33 | <td class="revision"><%= link_to_revision(entry.changeset, @repository) if entry.changeset %></td> | |
35 | <td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td> |
|
34 | <td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td> | |
36 | <td class="author"><%= changeset.nil? ? h(Redmine::CodesetUtil.replace_invalid_utf8(entry.lastrev.author.to_s.split('<').first)) : h(changeset.author) if entry.lastrev %></td> |
|
35 | <td class="author"><%= entry.changeset.nil? ? h(Redmine::CodesetUtil.replace_invalid_utf8(entry.lastrev.author.to_s.split('<').first)) : h(entry.changeset.author) if entry.lastrev %></td> | |
37 |
<td class="comments"><%=h truncate(changeset.comments, :length => 50) |
|
36 | <td class="comments"><%=h truncate(entry.changeset.comments, :length => 50) if entry.changeset %></td> | |
38 | <% end %> |
|
37 | <% end %> | |
39 | </tr> |
|
38 | </tr> | |
40 | <% end %> |
|
39 | <% end %> |
@@ -301,7 +301,8 module Redmine | |||||
301 | end |
|
301 | end | |
302 |
|
302 | |||
303 | class Entry |
|
303 | class Entry | |
304 | attr_accessor :name, :path, :kind, :size, :lastrev |
|
304 | attr_accessor :name, :path, :kind, :size, :lastrev, :changeset | |
|
305 | ||||
305 | def initialize(attributes={}) |
|
306 | def initialize(attributes={}) | |
306 | self.name = attributes[:name] if attributes[:name] |
|
307 | self.name = attributes[:name] if attributes[:name] | |
307 | self.path = attributes[:path] if attributes[:path] |
|
308 | self.path = attributes[:path] if attributes[:path] |
General Comments 0
You need to be logged in to leave comments.
Login now