Switchable the main branch on network graph

This commit is contained in:
Sato Hiroyuki 2013-01-29 17:25:17 +09:00
parent c84675ee06
commit 525a8cd3e9
9 changed files with 43 additions and 22 deletions

View file

@ -54,9 +54,10 @@ module ExtractsPath
input.gsub!(/^#{Gitlab.config.gitlab.relative_url_root}/, "")
# Remove project, actions and all other staff from path
input.gsub!(/^\/#{Regexp.escape(@project.path_with_namespace)}/, "")
input.gsub!(/^\/(tree|commits|blame|blob|refs)\//, "") # remove actions
input.gsub!(/^\/(tree|commits|blame|blob|refs|graph)\//, "") # remove actions
input.gsub!(/\?.*$/, "") # remove stamps suffix
input.gsub!(/.atom$/, "") # remove rss feed
input.gsub!(/.json$/, "") # remove json suffix
input.gsub!(/\/edit$/, "") # remove edit route part
if input.match(/^([[:alnum:]]{40})(.+)/)

View file

@ -9,8 +9,9 @@ module Gitlab
@max_count ||= 650
end
def initialize project
def initialize project, ref
@project = project
@ref = ref
@repo = project.repo
@ref_cache = {}
@ -66,9 +67,9 @@ module Gitlab
heads.select!{|h| h.is_a? Grit::Head or h.is_a? Grit::Remote}
# sort heads so the master is top and current branches are closer
heads.sort! do |a,b|
if a.name == "master"
if a.name == @ref
-1
elsif b.name == "master"
elsif b.name == @ref
1
else
b.commit.committed_date <=> a.commit.committed_date