##// END OF EJS Templates
Fixed: add group option to set the repository gid. Default is root (#2747)...
Nicolas Chuche -
r2416:6359e514771a
parent child
Show More
@@ -26,6 +26,7
26 # allow user to browse the repository within
26 # allow user to browse the repository within
27 # Redmine even for private project. If you want to share repositories
27 # Redmine even for private project. If you want to share repositories
28 # through Redmine.pm, you need to use the apache owner.
28 # through Redmine.pm, you need to use the apache owner.
29 # -g, --group=GROUP group of the repository. (default: root)
29 # --scm=SCM the kind of SCM repository you want to create (and register) in
30 # --scm=SCM the kind of SCM repository you want to create (and register) in
30 # Redmine (default: Subversion). reposman is able to create Git
31 # Redmine (default: Subversion). reposman is able to create Git
31 # and Subversion repositories. For all other kind (Bazaar,
32 # and Subversion repositories. For all other kind (Bazaar,
@@ -60,13 +61,14 require 'rdoc/usage'
60 require 'find'
61 require 'find'
61 require 'etc'
62 require 'etc'
62
63
63 Version = "1.2"
64 Version = "1.3"
64 SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
65 SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
65
66
66 opts = GetoptLong.new(
67 opts = GetoptLong.new(
67 ['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
68 ['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
68 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
69 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
69 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
70 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
71 ['--group', '-g', GetoptLong::REQUIRED_ARGUMENT],
70 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
72 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
71 ['--command' , '-c', GetoptLong::REQUIRED_ARGUMENT],
73 ['--command' , '-c', GetoptLong::REQUIRED_ARGUMENT],
72 ['--scm', GetoptLong::REQUIRED_ARGUMENT],
74 ['--scm', GetoptLong::REQUIRED_ARGUMENT],
@@ -83,6 +85,7 $quiet = false
83 $redmine_host = ''
85 $redmine_host = ''
84 $repos_base = ''
86 $repos_base = ''
85 $svn_owner = 'root'
87 $svn_owner = 'root'
88 $svn_group = 'root'
86 $use_groupid = true
89 $use_groupid = true
87 $svn_url = false
90 $svn_url = false
88 $test = false
91 $test = false
@@ -125,6 +128,7 begin
125 when '--svn-dir'; $repos_base = arg.dup
128 when '--svn-dir'; $repos_base = arg.dup
126 when '--redmine-host'; $redmine_host = arg.dup
129 when '--redmine-host'; $redmine_host = arg.dup
127 when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
130 when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
131 when '--group'; $svn_group = arg.dup; $use_groupid = false;
128 when '--url'; $svn_url = arg.dup
132 when '--url'; $svn_url = arg.dup
129 when '--scm'; $scm = arg.dup.capitalize; log("Invalid SCM: #{$scm}", :exit => true) unless SUPPORTED_SCM.include?($scm)
133 when '--scm'; $scm = arg.dup.capitalize; log("Invalid SCM: #{$scm}", :exit => true) unless SUPPORTED_SCM.include?($scm)
130 when '--command'; $command = arg.dup
134 when '--command'; $command = arg.dup
@@ -195,7 +199,7 def set_owner_and_rights(project, repos_path, &block)
195 if RUBY_PLATFORM =~ /mswin/
199 if RUBY_PLATFORM =~ /mswin/
196 yield if block_given?
200 yield if block_given?
197 else
201 else
198 uid, gid = Etc.getpwnam($svn_owner).uid, ($use_groupid ? Etc.getgrnam(project.identifier).gid : 0)
202 uid, gid = Etc.getpwnam($svn_owner).uid, ($use_groupid ? Etc.getgrnam(project.identifier).gid : Etc.getgrnam($svn_group).gid)
199 right = project.is_public ? 0775 : 0770
203 right = project.is_public ? 0775 : 0770
200 yield if block_given?
204 yield if block_given?
201 Find.find(repos_path) do |f|
205 Find.find(repos_path) do |f|
General Comments 0
You need to be logged in to leave comments. Login now