Patch #7528 » fetch_more.patch
| app/controllers/repositories_controller.rb (working copy) | ||
|---|---|---|
|
@properties = @repository.properties(@path, @rev)
|
||
|
end
|
||
|
|
||
|
def fetch_revisions
|
||
|
oldest = @repository.earliest_revision
|
||
|
if oldest > 0
|
||
|
@repository.fetch_older_changesets(oldest, 200)
|
||
|
else
|
||
|
# -1 means 'no revisions fetched yet' - so initialise with the latest
|
||
|
if oldest == -1
|
||
|
@repository.fetch_older_changesets(@repository.scm.info.lastrev.identifier.to_i, 200)
|
||
|
end
|
||
|
end
|
||
|
redirect_to :action => 'show', :id => @project
|
||
|
end
|
||
|
def revisions
|
||
|
@changeset_count = @repository.changesets.count
|
||
|
@changeset_pages = Paginator.new self, @changeset_count,
|
||
| app/models/repository/subversion.rb (working copy) | ||
|---|---|---|
|
path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '')
|
||
|
end
|
||
|
|
||
|
# we store only the most current 200 revs at first, but each time we call this
|
||
|
# we want to fetch another 200 to add to the history
|
||
|
# oldest - earliest rev stored in the db
|
||
|
def fetch_older_changesets(oldest, num_to_fetch)
|
||
|
if oldest > 0
|
||
|
identifier_from = oldest - 1
|
||
|
# load next set of older revisions
|
||
|
identifier_to = [identifier_from - num_to_fetch, 0].max
|
||
|
revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
|
||
|
revisions.reverse_each do |revision|
|
||
|
transaction do
|
||
|
changeset = Changeset.create(:repository => self,
|
||
|
:revision => revision.identifier,
|
||
|
:committer => revision.author,
|
||
|
:committed_on => revision.time,
|
||
|
:comments => revision.message)
|
||
|
revision.paths.each do |change|
|
||
|
changeset.create_change(change)
|
||
|
end unless changeset.new_record?
|
||
|
end
|
||
|
end unless revisions.nil?
|
||
|
# save the new earliest revision number, or 0 if we've got them all.
|
||
|
self.earliest_revision = identifier_to
|
||
|
self.save
|
||
|
end
|
||
|
end
|
||
|
def fetch_changesets
|
||
|
scm_info = scm.info
|
||
|
if scm_info
|
||
|
# latest revision found in database
|
||
|
db_revision = latest_changeset ? latest_changeset.revision.to_i : 0
|
||
|
# latest revision in the repository
|
||
|
scm_revision = scm_info.lastrev.identifier.to_i
|
||
|
# latest revision found in database
|
||
|
db_revision = latest_changeset ? latest_changeset.revision.to_i : [scm_revision - 199, 0].max
|
||
|
if db_revision < scm_revision
|
||
|
logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug?
|
||
|
identifier_from = db_revision + 1
|
||
| app/views/repositories/revisions.rhtml (working copy) | ||
|---|---|---|
|
<p class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></p>
|
||
|
<%if @changesets %>
|
||
|
<p><%= link_to l(:label_fetch_more_revisions), :action => "fetch_revisions", :id => @project, :path => '' %></p>
|
||
|
<%end%>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= stylesheet_link_tag "scm" %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||
| app/views/repositories/show.rhtml (working copy) | ||
|---|---|---|
|
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => nil }%>
|
||
|
<% if @path.blank? %>
|
||
|
<p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %></p>
|
||
|
<p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %>
|
||
|
<%if @changesets %>
|
||
|
<%= link_to l(:label_fetch_more_revisions), :action => "fetch_revisions", :id => @project, :path => '' %>
|
||
|
<%end%>
|
||
|
</p>
|
||
|
<% else %>
|
||
|
<p><%= link_to l(:label_view_revisions), :action => 'changes', :path => to_path_param(@path), :id => @project %></p>
|
||
|
<% end %>
|
||
| config/locales/en-GB.yml (working copy) | ||
|---|---|---|
|
setting_commit_logtime_enabled: Enable time logging
|
||
|
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
|
||
|
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
|
||
|
label_fetch_more_revisions: Fetch more revisions
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
label_latest_revision_plural: Latest revisions
|
||
|
label_view_revisions: View revisions
|
||
|
label_view_all_revisions: View all revisions
|
||
|
label_fetch_more_revisions: Fetch more revisions
|
||
|
label_max_size: Maximum size
|
||
|
label_sort_highest: Move to top
|
||
|
label_sort_higher: Move up
|
||
| lib/redmine.rb (working copy) | ||
|---|---|---|
|
map.project_module :repository do |map|
|
||
|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
|
||
|
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
|
||
|
map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
|
||
|
map.permission :view_changesets, :repositories => [:show, :revisions, :revision, :fetch_revisions]
|
||
|
map.permission :commit_access, {}
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »