r18633@gaspard (orig r1875): jplang | 2008-09-17 21:18:31 +0200
reposman: change #log arguments. r18634@gaspard (orig r1876): jplang | 2008-09-17 21:38:20 +0200 Slight change on git repository creation command. r18635@gaspard (orig r1877): jplang | 2008-09-17 21:47:36 +0200 Make --command option usable on Windows. r18636@gaspard (orig r1878): jplang | 2008-09-19 17:32:52 +0200 Adds watch/unwatch functionality at forum topic level (#1912). Users who create/reply a topic are automatically added as watchers but are now able to unwatch the topic. r18637@gaspard (orig r1879): winterheart | 2008-09-19 18:15:49 +0200 update of ru.yml r18638@gaspard (orig r1880): winterheart | 2008-09-19 18:17:35 +0200 #1918, translation for zh-tw r18639@gaspard (orig r1881): winterheart | 2008-09-19 18:20:45 +0200 fixed #1920, patch for Hungarian language r18640@gaspard (orig r1882): winterheart | 2008-09-19 18:23:04 +0200 patch #1922, update for nl.yml r18641@gaspard (orig r1883): winterheart | 2008-09-19 18:26:19 +0200 #1923, updated zh.yml r18642@gaspard (orig r1884): winterheart | 2008-09-19 18:30:39 +0200 #1924, update for da.yml r18643@gaspard (orig r1885): winterheart | 2008-09-19 18:33:08 +0200 #1925, patch for lt.yml git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1886 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
+14
-13
@@ -90,9 +90,10 @@ $test = false
|
||||
$force = false
|
||||
$scm = 'Subversion'
|
||||
|
||||
def log(text,level=0, exit=false)
|
||||
def log(text, options={})
|
||||
level = options[:level] || 0
|
||||
puts text unless $quiet or level > $verbose
|
||||
exit 1 if exit
|
||||
exit 1 if options[:exit]
|
||||
end
|
||||
|
||||
def system_or_raise(command)
|
||||
@@ -112,7 +113,7 @@ module SCM
|
||||
Dir.mkdir path
|
||||
Dir.chdir(path) do
|
||||
system_or_raise "git --bare init --shared"
|
||||
system_or_raise "git-update-server-info"
|
||||
system_or_raise "git update-server-info"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -126,7 +127,7 @@ begin
|
||||
when '--redmine-host'; $redmine_host = arg.dup
|
||||
when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
|
||||
when '--url'; $svn_url = arg.dup
|
||||
when '--scm'; $scm = arg.dup.capitalize; log("Invalid SCM: #{$scm}", 0, true) unless SUPPORTED_SCM.include?($scm)
|
||||
when '--scm'; $scm = arg.dup.capitalize; log("Invalid SCM: #{$scm}", :exit => true) unless SUPPORTED_SCM.include?($scm)
|
||||
when '--command'; $command = arg.dup
|
||||
when '--verbose'; $verbose += 1
|
||||
when '--test'; $test = true
|
||||
@@ -149,7 +150,7 @@ if $command.nil?
|
||||
begin
|
||||
scm_module = SCM.const_get($scm)
|
||||
rescue
|
||||
log("Please use --command option to specify how to create a #{$scm} repository.", 0, true)
|
||||
log("Please use --command option to specify how to create a #{$scm} repository.", :exit => true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,10 +161,10 @@ if ($redmine_host.empty? or $repos_base.empty?)
|
||||
end
|
||||
|
||||
unless File.directory?($repos_base)
|
||||
log("directory '#{$repos_base}' doesn't exists", 0, true)
|
||||
log("directory '#{$repos_base}' doesn't exists", :exit => true)
|
||||
end
|
||||
|
||||
log("querying Redmine for projects...", 1);
|
||||
log("querying Redmine for projects...", :level => 1);
|
||||
|
||||
$redmine_host.gsub!(/^/, "http://") unless $redmine_host.match("^https?://")
|
||||
$redmine_host.gsub!(/\/$/, '')
|
||||
@@ -173,16 +174,16 @@ wsdl_url = "#{$redmine_host}/sys/service.wsdl";
|
||||
begin
|
||||
soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
|
||||
rescue => e
|
||||
log("Unable to connect to #{wsdl_url} : #{e}", 0, true)
|
||||
log("Unable to connect to #{wsdl_url} : #{e}", :exit => true)
|
||||
end
|
||||
|
||||
projects = soap.ProjectsWithRepositoryEnabled
|
||||
|
||||
if projects.nil?
|
||||
log('no project found, perhaps you forgot to "Enable WS for repository management"', 0, true)
|
||||
log('no project found, perhaps you forgot to "Enable WS for repository management"', :exit => true)
|
||||
end
|
||||
|
||||
log("retrieved #{projects.size} projects", 1)
|
||||
log("retrieved #{projects.size} projects", :level => 1)
|
||||
|
||||
def set_owner_and_rights(project, repos_path, &block)
|
||||
if RUBY_PLATFORM =~ /mswin/
|
||||
@@ -209,7 +210,7 @@ def owner_name(file)
|
||||
end
|
||||
|
||||
projects.each do |project|
|
||||
log("treating project #{project.name}", 1)
|
||||
log("treating project #{project.name}", :level => 1)
|
||||
|
||||
if project.identifier.empty?
|
||||
log("\tno identifier for project #{project.name}")
|
||||
@@ -219,7 +220,7 @@ projects.each do |project|
|
||||
next;
|
||||
end
|
||||
|
||||
repos_path = $repos_base + "/" + project.identifier
|
||||
repos_path = File.join($repos_base, project.identifier).gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
||||
|
||||
if File.directory?(repos_path)
|
||||
|
||||
@@ -247,7 +248,7 @@ projects.each do |project|
|
||||
# if repository is already declared in redmine, we don't create
|
||||
# unless user use -f with reposman
|
||||
if $force == false and not project.repository.nil?
|
||||
log("\trepository for project #{project.identifier} already exists in Redmine", 1)
|
||||
log("\trepository for project #{project.identifier} already exists in Redmine", :level => 1)
|
||||
next
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user