Project

General

Profile

Patch #7494 ยป hg-http-1.1.1.patch

Giuseppe Lippolis, 2011-01-30 20:35

View differences:

lib/redmine/scm/adapters/mercurial_adapter.rb (working copy)
TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial"
TEMPLATE_NAME = "hg-template"
TEMPLATE_EXTENSION = "tmpl"
TEMP_DIR = File.dirname(__FILE__) + "/../../../../tmp/hgrepository"
class << self
def client_version
@@client_version ||= (hgversion || [])
......
return nil if $? && $?.exitstatus != 0
blame
end
def target(path)
path||=''
base = path.match(/^\//) ? root_url : url
path="#{base}/#{path}".gsub(/[?<>\*]/, '')
path = clone(path) if is_remote(path)
shell_quote(path)
end
#determinate is remote repository
def is_remote(path)
path =~ /http|https/
end
#retrive local repository path
def get_local_path(url)
Dir.mkdir(TEMP_DIR) if !File.directory?(TEMP_DIR)
repo=url.split('/')[-1]
"#{TEMP_DIR}/#{repo}"
end
#clone/update remote repository
def clone(url)
local=get_local_path(url)
cmd=""
if File.directory?(local)
cmd << "#{HG_BIN} pull -u -R #{local}"
else
Dir.mkdir(local)
cmd << "#{HG_BIN} clone #{url} #{local}"
end
shellout(cmd)
local
end
end
end
end
    (1-1/1)