branch: error out when attempting to create a branch that already exists

This commit is contained in:
Josh Holtrop 2012-06-27 09:34:39 -04:00
parent 225db4f5ce
commit d3a0208d12

4
jsvn
View File

@ -468,6 +468,10 @@ def branch(argv, svn, out):
Popen([svn, 'rm', root + '/branches/' + branch_name, '-m',
"Removed branch '%s'" % branch_name], stdout=out).wait()
return RET_OK
bl = get_svn_branch_list(svn)
if branch_name in bl:
sys.stderr.write('Error: branch %s already exists\n' % branch_name)
return RET_ERR
comment = "Created '%s' branch" % branch_name
branch_path = root + '/branches/' + branch_name
Popen([svn, 'copy', origin, branch_path, '-m', comment], stdout=out).wait()