恢复版本

This commit is contained in:
huang 2015-12-21 13:53:22 +08:00
parent 2d170d90b3
commit ab1397d982
3 changed files with 4 additions and 6 deletions

View File

@ -107,7 +107,7 @@ class Repository < ActiveRecord::Base
def scm def scm
unless @scm unless @scm
@scm = self.scm_adapter.new(url, root_url, @scm = self.scm_adapter.new(url, root_url,
login, password, path_encoding, project_id) login, password, path_encoding)
if root_url.blank? && @scm.root_url.present? if root_url.blank? && @scm.root_url.present?
update_attribute(:root_url, @scm.root_url) update_attribute(:root_url, @scm.root_url)
end end

View File

@ -80,7 +80,7 @@ module Redmine
end end
def initialize(url, root_url=nil, login=nil, password=nil, def initialize(url, root_url=nil, login=nil, password=nil,
path_encoding=nil, project_id) path_encoding=nil)
@url = url @url = url
@login = login if login && !login.empty? @login = login if login && !login.empty?
@password = (password || "") if @login @password = (password || "") if @login

View File

@ -13,12 +13,10 @@ module Redmine
attr_accessor :is_default attr_accessor :is_default
end end
def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil, project_id) def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil)
super super
@g = Gitlab.client @g = Gitlab.client
r = Repository.where("url =? and project_id =?", url, project_id).first @project = Repository.find_by_url(url).project.gpid
@project = r.project.gpid
# @project = Repository.find_by_url(url).project.gpid
@path_encoding = path_encoding.blank? ? 'UTF-8' : path_encoding @path_encoding = path_encoding.blank? ? 'UTF-8' : path_encoding
end end