Patch #7528 » fetch_more.patch
| app/controllers/repositories_controller.rb (working copy) | ||
|---|---|---|
| 96 | 96 |
@properties = @repository.properties(@path, @rev) |
| 97 | 97 |
end |
| 98 | 98 |
|
| 99 | ||
| 100 |
# fetch the next set of 200 revisions from the repo. |
|
| 101 |
def fetch_revisions |
|
| 102 |
oldest = @repository.earliest_revision |
|
| 103 |
if oldest > 0 |
|
| 104 |
@repository.fetch_older_changesets(oldest, 200) |
|
| 105 |
redirect_to :action => 'show', :id => @project |
|
| 106 |
end |
|
| 107 |
end |
|
| 108 | ||
| 109 | ||
| 99 | 110 |
def revisions |
| 100 | 111 |
@changeset_count = @repository.changesets.count |
| 101 | 112 |
@changeset_pages = Paginator.new self, @changeset_count, |
| app/models/repository/subversion.rb (working copy) | ||
|---|---|---|
| 40 | 40 |
path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '')
|
| 41 | 41 |
end |
| 42 | 42 |
|
| 43 | ||
| 44 | ||
| 45 |
# we store only the most current 200 revs at first, but each time we call this |
|
| 46 |
# we want to fetch another 200 to add to the history |
|
| 47 |
# oldest - earliest rev stored in the db |
|
| 48 |
def fetch_older_changesets(oldest, num_to_fetch) |
|
| 49 |
if oldest > 0 |
|
| 50 |
identifier_from = oldest - 1 |
|
| 51 |
# load next set of older revisions |
|
| 52 |
identifier_to = [identifier_from - num_to_fetch, 0].max |
|
| 53 |
revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
|
|
| 54 |
revisions.reverse_each do |revision| |
|
| 55 |
transaction do |
|
| 56 |
changeset = Changeset.create(:repository => self, |
|
| 57 |
:revision => revision.identifier, |
|
| 58 |
:committer => revision.author, |
|
| 59 |
:committed_on => revision.time, |
|
| 60 |
:comments => revision.message) |
|
| 61 | ||
| 62 |
revision.paths.each do |change| |
|
| 63 |
changeset.create_change(change) |
|
| 64 |
end unless changeset.new_record? |
|
| 65 |
end |
|
| 66 |
end unless revisions.nil? |
|
| 67 |
# save the new earliest revision number, or 0 if we've got them all. |
|
| 68 |
self.earliest_revision = identifier_to |
|
| 69 |
self.save |
|
| 70 |
end |
|
| 71 |
end |
|
| 72 | ||
| 73 | ||
| 43 | 74 |
def fetch_changesets |
| 44 | 75 |
scm_info = scm.info |
| 45 | 76 |
if scm_info |
| 46 |
# latest revision found in database |
|
| 47 |
db_revision = latest_changeset ? latest_changeset.revision.to_i : 0 |
|
| 48 | 77 |
# latest revision in the repository |
| 49 | 78 |
scm_revision = scm_info.lastrev.identifier.to_i |
| 79 |
# latest revision found in database |
|
| 80 |
db_revision = latest_changeset ? latest_changeset.revision.to_i : [scm_revision - 199, 0].max |
|
| 50 | 81 |
if db_revision < scm_revision |
| 51 | 82 |
logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug?
|
| 52 | 83 |
identifier_from = db_revision + 1 |
| app/views/repositories/revisions.rhtml (working copy) | ||
|---|---|---|
| 11 | 11 | |
| 12 | 12 |
<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p> |
| 13 | 13 | |
| 14 |
<%if @changesets %> |
|
| 15 |
<p><%= link_to l(:label_fetch_more_revisions), :action => "fetch_revisions", :id => @project, :path => '' %></p> |
|
| 16 |
<%end%> |
|
| 17 | ||
| 14 | 18 |
<% content_for :header_tags do %> |
| 15 | 19 |
<%= stylesheet_link_tag "scm" %> |
| 16 | 20 |
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
| app/views/repositories/show.rhtml (working copy) | ||
|---|---|---|
| 17 | 17 |
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => nil }%>
|
| 18 | 18 | |
| 19 | 19 |
<% if @path.blank? %> |
| 20 |
<p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %></p> |
|
| 20 |
<p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %> |
|
| 21 |
<%if @changesets %> |
|
| 22 |
<%= link_to l(:label_fetch_more_revisions), :action => "fetch_revisions", :id => @project, :path => '' %> |
|
| 23 |
<%end%> |
|
| 24 |
</p> |
|
| 21 | 25 |
<% else %> |
| 22 | 26 |
<p><%= link_to l(:label_view_revisions), :action => 'changes', :path => to_path_param(@path), :id => @project %></p> |
| 23 | 27 |
<% end %> |
| config/locales/en-GB.yml (working copy) | ||
|---|---|---|
| 940 | 940 |
setting_commit_logtime_enabled: Enable time logging |
| 941 | 941 |
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
|
| 942 | 942 |
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart |
| 943 |
label_fetch_more_revisions: Fetch more revisions |
|
| config/locales/en.yml (working copy) | ||
|---|---|---|
| 639 | 639 |
label_latest_revision_plural: Latest revisions |
| 640 | 640 |
label_view_revisions: View revisions |
| 641 | 641 |
label_view_all_revisions: View all revisions |
| 642 |
label_fetch_more_revisions: Fetch more revisions |
|
| 642 | 643 |
label_max_size: Maximum size |
| 643 | 644 |
label_sort_highest: Move to top |
| 644 | 645 |
label_sort_higher: Move up |
| lib/redmine.rb (working copy) | ||
|---|---|---|
| 122 | 122 |
map.project_module :repository do |map| |
| 123 | 123 |
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
|
| 124 | 124 |
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] |
| 125 |
map.permission :view_changesets, :repositories => [:show, :revisions, :revision] |
|
| 125 |
map.permission :view_changesets, :repositories => [:show, :revisions, :revision, :fetch_revisions]
|
|
| 126 | 126 |
map.permission :commit_access, {}
|
| 127 | 127 |
end |
| 128 | 128 | |