]> source.dussan.org Git - redmine.git/commitdiff
Fixed: add group option to set the repository gid. Default is root (#2747)
authorNicolas Chuche <nicolas.chuche@barna.be>
Mon, 16 Feb 2009 19:33:43 +0000 (19:33 +0000)
committerNicolas Chuche <nicolas.chuche@barna.be>
Mon, 16 Feb 2009 19:33:43 +0000 (19:33 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2478 e93f8b46-1217-0410-a6f0-8f06a7374b81

extra/svn/reposman.rb

index 84e9bc2da10792d03c51be02c88560116ba3d063..f4238ab22021b7e9a273d2f46c37cbcb62450e7b 100755 (executable)
@@ -26,6 +26,7 @@
 #                             allow user to browse the repository within
 #                             Redmine even for private project. If you want to share repositories
 #                             through Redmine.pm, you need to use the apache owner.
+#   -g, --group=GROUP         group of the repository. (default: root)
 #   --scm=SCM                 the kind of SCM repository you want to create (and register) in
 #                             Redmine (default: Subversion). reposman is able to create Git 
 #                             and Subversion repositories. For all other kind (Bazaar,
@@ -60,13 +61,14 @@ require 'rdoc/usage'
 require 'find'
 require 'etc'
 
-Version = "1.2"
+Version = "1.3"
 SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
 
 opts = GetoptLong.new(
                       ['--svn-dir',      '-s', GetoptLong::REQUIRED_ARGUMENT],
                       ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
                       ['--owner',        '-o', GetoptLong::REQUIRED_ARGUMENT],
+                      ['--group',        '-g', GetoptLong::REQUIRED_ARGUMENT],
                       ['--url',          '-u', GetoptLong::REQUIRED_ARGUMENT],
                       ['--command' ,     '-c', GetoptLong::REQUIRED_ARGUMENT],
                       ['--scm',                GetoptLong::REQUIRED_ARGUMENT],
@@ -83,6 +85,7 @@ $quiet        = false
 $redmine_host = ''
 $repos_base   = ''
 $svn_owner    = 'root'
+$svn_group    = 'root'
 $use_groupid  = true
 $svn_url      = false
 $test         = false
@@ -125,6 +128,7 @@ begin
     when '--svn-dir';        $repos_base   = arg.dup
     when '--redmine-host';   $redmine_host = arg.dup
     when '--owner';          $svn_owner    = arg.dup; $use_groupid = false;
+    when '--group';          $svn_group    = arg.dup; $use_groupid = false;
     when '--url';            $svn_url      = arg.dup
     when '--scm';            $scm          = arg.dup.capitalize; log("Invalid SCM: #{$scm}", :exit => true) unless SUPPORTED_SCM.include?($scm)
     when '--command';        $command =      arg.dup
@@ -195,7 +199,7 @@ def set_owner_and_rights(project, repos_path, &block)
   if RUBY_PLATFORM =~ /mswin/
     yield if block_given?
   else
-    uid, gid = Etc.getpwnam($svn_owner).uid, ($use_groupid ? Etc.getgrnam(project.identifier).gid : 0)
+    uid, gid = Etc.getpwnam($svn_owner).uid, ($use_groupid ? Etc.getgrnam(project.identifier).gid : Etc.getgrnam($svn_group).gid)
     right = project.is_public ? 0775 : 0770
     yield if block_given?
     Find.find(repos_path) do |f|