add -d to branch for removing branch, update comments
This commit is contained in:
parent
6e57fda0c4
commit
9f1741bfcc
14
jsvn
14
jsvn
@ -9,9 +9,10 @@
|
|||||||
# appropriate subcommands if so.
|
# appropriate subcommands if so.
|
||||||
#
|
#
|
||||||
# Implemented subcommands:
|
# Implemented subcommands:
|
||||||
# branch[es] <branch_name>
|
# branch[es] [[-d] <branch_name>]
|
||||||
# - with no arguments, list branches with '*' by the current one
|
# - with no arguments, list branches with '*' by the current one
|
||||||
# - with an argument, create a new branch from the current one
|
# - with -d, delete <branch>
|
||||||
|
# - otherwise, create a new branch from the current one
|
||||||
# tags
|
# tags
|
||||||
# - list tags
|
# - list tags
|
||||||
# switch <short_name>
|
# switch <short_name>
|
||||||
@ -21,6 +22,8 @@
|
|||||||
# merge <branch>
|
# merge <branch>
|
||||||
# - merge branch <branch> into the current WC path
|
# - merge branch <branch> into the current WC path
|
||||||
# - falls back to Subversion "merge" if <branch> doesn't exist
|
# - falls back to Subversion "merge" if <branch> doesn't exist
|
||||||
|
# root
|
||||||
|
# - output root URL (for use on shell such as "svn log $(svn root)/tags")
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@ -95,9 +98,14 @@ def branch(argv, svn):
|
|||||||
sys.stdout.write('*' if b == current else ' ')
|
sys.stdout.write('*' if b == current else ' ')
|
||||||
sys.stdout.write(b + '\n')
|
sys.stdout.write(b + '\n')
|
||||||
return 0
|
return 0
|
||||||
branch_name = argv[1]
|
branch_name = argv[-1]
|
||||||
origin = getSVNTopLevel(svn)
|
origin = getSVNTopLevel(svn)
|
||||||
root = getSVNRoot(svn)
|
root = getSVNRoot(svn)
|
||||||
|
if len(argv) >= 3 and argv[1] == "-d":
|
||||||
|
# delete branch in argv[2]
|
||||||
|
Popen([svn, 'rm', root + '/branches/' + argv[2], '-m',
|
||||||
|
"Removed branch '%s'" % branch_name]).wait()
|
||||||
|
return 0
|
||||||
if origin == '' or root == '':
|
if origin == '' or root == '':
|
||||||
sys.stderr.write("Could not determine origin/root URL\n")
|
sys.stderr.write("Could not determine origin/root URL\n")
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user