Fixed: add group option to set the repository gid. Default is root (#2747)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2478 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Nicolas Chuche 16 years ago
parent d643d9a94c
commit 6359e51477
  1. 8
      extra/svn/reposman.rb

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

Loading…
Cancel
Save