1、数据任务迁移

2、添加commits总数统计
This commit is contained in:
huang 2015-11-03 17:19:19 +08:00
parent a4209bc9f7
commit 6e7950983b
4 changed files with 18 additions and 24 deletions

View File

@ -224,10 +224,6 @@ update
#if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
# g = Gitlab.client
# project = g.project(20)
# rr = g.trees(project.id, @path)
# r = g.get ("/projects/#{@project}/repository/tree")
# :name, :path, :kind, :size, :lastrev, :changeset
@entries = @repository.entries(@path, @rev)
# @trees = g.trees(project, @path)
@ -241,10 +237,18 @@ update
#Modified by young
# (show_error_not_found; return) unless @entries
g = Gitlab.client
count = 0
(0..100).each do |page|
if g.commits(@project.gpid,:page => page).count == 0
break
else
count = count + g.commits(@project.gpid,:page => page).count
end
end
@changesets = g.commits(@project.gpid)
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_count = @changesets.count
@changesets_all_count = count
@changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@ -271,7 +275,9 @@ update
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
g = Gitlab.client
@changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
@commits = g.commits(@project.gpid, page:params[:pamge])
@commit = g.commit(@project.gpid,@rev)
# @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
@properties = @repository.properties(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev)

View File

@ -14,7 +14,7 @@
<%= render_properties(@properties) %>
<div class="mt10">
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
<%= render(:partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @commits, :entry => @entry }) unless @commits.empty? %>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>

View File

@ -40,7 +40,7 @@
</span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %></font> 提交
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev} %></font> 提交
</span>
</div>
<% end %>

View File

@ -1,23 +1,11 @@
#coding=utf-8
namespace :rep_fault do
desc "update fault rep"
desc "set ossean's type value"
task :rep_update => :environment do
Project.all.each do |project|
if project.repositories.count > 0
unless Repository.where("project_id =? and type = ?",project, "Repository::Gitlab").blank?
project.repositories.each do |repository|
repository.is_default =1
repository.save
end
end
end
end
rep = Repository.find(400)
rep.type = "Repository::Gitlab"
rep.save
end
# desc "update ossean's data"
# task :update_type => :environment do
# repository = Repository.find(400)
# repository.update_attributes(:type => "Repository::Git")
# end
end