增加了注释

hjq_course
houxiang 10 years ago
parent f6bfd7824d
commit fdedcbfa81

@ -350,32 +350,14 @@ update
alias_method :browse, :show
#add by houxiang
def get_commits(id)
g = Gitlab.client
tmp_commit_count = g.commits(id,page:0).count
commit_count = 0
i=0
while tmp_commit_count!=0
commit_count = commit_count+tmp_commit_count
i=i+1
tmp_commit_count = g.commits(id,page:i).count
end
return commit_count
end
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
g = Gitlab.client
limit = 20
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
@commits_count = params[:commit_count].to_i
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
@ -387,6 +369,7 @@ update
render :layout => 'base_projects'
end
def revisions
@changeset_count = @repository.changesets.count
@changeset_pages = Paginator.new @changeset_count,

Loading…
Cancel
Save