##// END OF EJS Templates
Adds --scm option support to reposman. It can be used to register non subversion repositories in Redmine....
Jean-Philippe Lang -
r1807:0b74888fb8c6
parent child
Show More
@@ -6,65 +6,49
6 6 #
7 7 # == Usage
8 8 #
9 # reposman [ -h | --help ] [ -v | --verbose ] [ -V | --version ] [ -q | --quiet ] -s /var/svn -r redmine.host.org
10 # example: reposman --svn-dir=/var/svn --redmine-host=redmine.mydomain.foo
11 # reposman -s /var/svn -r redmine.mydomain.foo
9 # reposman [OPTIONS...] -s [DIR] -r [HOST]
10 #
11 # Examples:
12 # reposman --svn-dir=/var/svn --redmine-host=redmine.example.net
13 # reposman -s /var/svn -r redmine.example.net -u http://svn.example.net
12 14 #
13 15 # == Arguments (mandatory)
14 #
15 # -s, --svn-dir=DIR
16 # use DIR as base directory for svn repositories
17 16 #
18 # -r, --redmine-host=HOST
19 # assume Redmine is hosted on HOST.
20 # you can use :
21 # * -r redmine.mydomain.foo (will add http://)
22 # * -r http://redmine.mydomain.foo
23 # * -r https://mydomain.foo/redmine
17 # -s, --svn-dir=DIR use DIR as base directory for svn repositories
18 # -r, --redmine-host=HOST assume Redmine is hosted on HOST. Examples:
19 # -r redmine.example.net
20 # -r http://redmine.example.net
21 # -r https://example.net/redmine
24 22 #
25 23 # == Options
26 24 #
27 # -o, --owner=OWNER
28 # owner of the repository. using the rails login allow user to browse
29 # the repository in Redmine even for private project
30 #
31 # -u, --url=URL
32 # the base url Redmine will use to access your repositories. This
33 # will be used to register the repository in Redmine so that user
34 # doesn't need to do anything. reposman will add the identifier to this url :
35 #
36 # -u https://my.svn.server/my/reposity/root # if the repository can be access by http
37 # -u file:///var/svn/ # if the repository is local
38 # if this option isn't set, reposman won't register the repository
39 #
40 # --scm
41 # SCM vendor used to register the repository in Redmine (default: Subversion)
42 # Can be one of the other supported SCM: Bazaar, Cvs, Darcs, Filesystem, Git, Mercurial (case sensitive).
43 # This option should be used when using --command to create another kind
44 # of repository.
45 #
46 # -c, --command=COMMAND
47 # the default is to create an subversion repository. You can use this command
48 # to create another kind of repository
49 #
50 # -f, --force
51 # force repository creation even if a repository is already declared in redmine.
52 #
53 # -t, --test
54 # only show what should be done
55 #
56 # -h, --help:
57 # show help and exit
58 #
59 # -v, --verbose
60 # verbose
61 #
62 # -V, --version
63 # print version and exit
64 #
65 # -q, --quiet
66 # no log
67 #
25 # -o, --owner=OWNER owner of the repository. using the rails login
26 # allow user to browse the repository within
27 # Redmine even for private project
28 # -u, --url=URL the base url Redmine will use to access your
29 # repositories. This option is used to automatically
30 # register the repositories in Redmine. The project
31 # identifier will be appended to this url. Examples:
32 # -u https://example.net/svn
33 # -u file:///var/svn/
34 # if this option isn't set, reposman won't register
35 # the repositories in Redmine
36 # -c, --command=COMMAND use this command instead of "svnadmin create" to
37 # create a repository. This option can be used to
38 # create non-subversion repositories
39 # --scm SCM vendor used to register the repository in
40 # Redmine (default: Subversion). Can be one of the
41 # other supported SCM: Bazaar, Darcs, Filesystem,
42 # Git, Mercurial (case sensitive).
43 # This option should be used when both options --url
44 # and --command are used.
45 # -f, --force force repository creation even if the project
46 # repository is already declared in Redmine
47 # -t, --test only show what should be done
48 # -h, --help show help and exit
49 # -v, --verbose verbose
50 # -V, --version print version and exit
51 # -q, --quiet no log
68 52
69 53 require 'getoptlong'
70 54 require 'rdoc/usage'
@@ -72,15 +56,16 require 'soap/wsdlDriver'
72 56 require 'find'
73 57 require 'etc'
74 58
75 Version = "1.0"
59 Version = "1.1"
60 SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
76 61
77 62 opts = GetoptLong.new(
78 63 ['--svn-dir', '-s', GetoptLong::REQUIRED_ARGUMENT],
79 64 ['--redmine-host', '-r', GetoptLong::REQUIRED_ARGUMENT],
80 65 ['--owner', '-o', GetoptLong::REQUIRED_ARGUMENT],
81 66 ['--url', '-u', GetoptLong::REQUIRED_ARGUMENT],
82 ['--scm', GetoptLong::REQUIRED_ARGUMENT],
83 67 ['--command' , '-c', GetoptLong::REQUIRED_ARGUMENT],
68 ['--scm', GetoptLong::REQUIRED_ARGUMENT],
84 69 ['--test', '-t', GetoptLong::NO_ARGUMENT],
85 70 ['--force', '-f', GetoptLong::NO_ARGUMENT],
86 71 ['--verbose', '-v', GetoptLong::NO_ARGUMENT],
@@ -114,7 +99,7 begin
114 99 when '--redmine-host'; $redmine_host = arg.dup
115 100 when '--owner'; $svn_owner = arg.dup; $use_groupid = false;
116 101 when '--url'; $svn_url = arg.dup
117 when '--scm'; $scm = arg.dup
102 when '--scm'; $scm = arg.dup; log("Invalid SCM: #{$scm}", 0, true) unless SUPPORTED_SCM.include?($scm)
118 103 when '--command'; $command = arg.dup
119 104 when '--verbose'; $verbose += 1
120 105 when '--test'; $test = true
@@ -132,6 +117,12 if $test
132 117 log("running in test mode")
133 118 end
134 119
120 # Make sure command is overridden if SCM vendor is not Subversion
121 if $scm != 'Subversion' && $command == 'svnadmin create'
122 log("Please use --command option to specify how to create a #{$scm} repository.", 0, true)
123 end
124
125
135 126 $svn_url += "/" if $svn_url and not $svn_url.match(/\/$/)
136 127
137 128 if ($redmine_host.empty? or $repos_base.empty?)
General Comments 0
You need to be logged in to leave comments. Login now