Project

General

Profile

Patch #4029 » reposman.diff

Lars Scheithauer, 2009-10-14 15:05

View differences:

extra/svn/reposman.rb (working copy)
73 73
                      ['--scm',                GetoptLong::REQUIRED_ARGUMENT],
74 74
                      ['--test',         '-t', GetoptLong::NO_ARGUMENT],
75 75
                      ['--force',        '-f', GetoptLong::NO_ARGUMENT],
76
                      ['--delete',       '-d', GetoptLong::NO_ARGUMENT],
76 77
                      ['--verbose',      '-v', GetoptLong::NO_ARGUMENT],
77 78
                      ['--version',      '-V', GetoptLong::NO_ARGUMENT],
78 79
                      ['--help'   ,      '-h', GetoptLong::NO_ARGUMENT],
......
88 89
$svn_url      = false
89 90
$test         = false
90 91
$force        = false
92
$delete       = false
91 93
$scm          = 'Subversion'
92 94

  
93 95
def log(text, options={})
......
132 134
    when '--verbose';        $verbose += 1
133 135
    when '--test';           $test = true
134 136
    when '--force';          $force = true
137
    when '--delete';         $delete = true
135 138
    when '--version';        puts Version; exit
136 139
    when '--help';           RDoc::usage
137 140
    when '--quiet';          $quiet = true
......
209 212
    Etc.getpwuid( File.stat(file).uid ).name  
210 213
end
211 214

  
215
if $delete == true
216
	log("checking for svn directories to delete", :level => 1)
217
	svnprojects = Dir.glob("#{$repos_base}/*/")
218
	svnprojects.each do |svnproject|
219
		matches = svnproject.match(/\/([a-z0-9-]+)\/$/)
220
		svnname = matches[1]
221

  
222
		if svnname.match(/^\./)
223
			next
224
		end
225

  
226
		$found = false
227
		projects.each do |project|
228
			if project.identifier.match(svnname)
229
				$found = true
230
			end
231
		end
232

  
233
		if $found == false 
234
			log("\tdeleting svn project #{svnproject} as it doesn't exist in redmine anymore")
235
			FileUtils.rm_r(svnproject)
236
		end
237
	end
238
end
239

  
212 240
projects.each do |project|
213 241
  log("treating project #{project.name}", :level => 1)
214 242

  
(1-1/3)