added tag command, similar to branch command
This commit is contained in:
parent
286c5195ec
commit
a88c50569c
36
jsvn
36
jsvn
@ -13,8 +13,10 @@
|
|||||||
# - with no arguments, list branches with '*' by the current one
|
# - with no arguments, list branches with '*' by the current one
|
||||||
# - with -d, delete <branch>
|
# - with -d, delete <branch>
|
||||||
# - otherwise, create a new branch from the current one
|
# - otherwise, create a new branch from the current one
|
||||||
# tags
|
# tag[s] [[-d] <tag_name>]
|
||||||
# - list tags
|
# - with no arguments, list tags
|
||||||
|
# - with -d, delete <tag>
|
||||||
|
# - otherwise, create a new tag from the current branch
|
||||||
# switch <short_name>
|
# switch <short_name>
|
||||||
# - switch to 'trunk', branch name, or tag name without having to specify
|
# - switch to 'trunk', branch name, or tag name without having to specify
|
||||||
# the full URL
|
# the full URL
|
||||||
@ -94,6 +96,7 @@ def branch(argv, svn):
|
|||||||
if len(argv) < 2:
|
if len(argv) < 2:
|
||||||
bl = ['trunk'] + getSVNBranchList(svn)
|
bl = ['trunk'] + getSVNBranchList(svn)
|
||||||
current = getSVNTopLevel(svn).split('/')[-1]
|
current = getSVNTopLevel(svn).split('/')[-1]
|
||||||
|
bl.sort()
|
||||||
for b in bl:
|
for b in bl:
|
||||||
sys.stdout.write('*' if b == current else ' ')
|
sys.stdout.write('*' if b == current else ' ')
|
||||||
sys.stdout.write(b + '\n')
|
sys.stdout.write(b + '\n')
|
||||||
@ -114,10 +117,27 @@ def branch(argv, svn):
|
|||||||
Popen([svn, 'copy', origin, branch_path, '-m', comment]).wait()
|
Popen([svn, 'copy', origin, branch_path, '-m', comment]).wait()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def tags(argv, svn):
|
def tag(argv, svn):
|
||||||
tl = getSVNTagList(svn)
|
if len(argv) < 2:
|
||||||
for t in tl:
|
tl = getSVNTagList(svn)
|
||||||
sys.stdout.write(t + '\n')
|
tl.sort()
|
||||||
|
for t in tl:
|
||||||
|
sys.stdout.write(t + '\n')
|
||||||
|
return 0
|
||||||
|
tag_name = argv[-1]
|
||||||
|
origin = getSVNTopLevel(svn)
|
||||||
|
root = getSVNRoot(svn)
|
||||||
|
if len(argv) >= 3 and argv[1] == "-d":
|
||||||
|
# delete tag in argv[2]
|
||||||
|
Popen([svn, 'rm', root + '/tags/' + argv[2], '-m',
|
||||||
|
"Removed tag '%s'" % tag_name]).wait()
|
||||||
|
return 0
|
||||||
|
if origin == '' or root == '':
|
||||||
|
sys.stderr.write("Could not determine origin/root URL\n")
|
||||||
|
return 1
|
||||||
|
comment = "Created '%s' tag" % tag_name
|
||||||
|
tag_path = root + '/tags/' + tag_name
|
||||||
|
Popen([svn, 'copy', origin, tag_path, '-m', comment]).wait()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def switch(argv, svn):
|
def switch(argv, svn):
|
||||||
@ -186,8 +206,8 @@ def main(argv):
|
|||||||
if r >= 0:
|
if r >= 0:
|
||||||
return r
|
return r
|
||||||
|
|
||||||
if argv[0] == "tags":
|
if argv[0] == "tag" or argv[0] == "tags":
|
||||||
return tags(argv, realsvn)
|
return tag(argv, realsvn)
|
||||||
|
|
||||||
if argv[0] == "diff" and colordiff != '':
|
if argv[0] == "diff" and colordiff != '':
|
||||||
diff_out = Popen([realsvn] + argv, stdout=PIPE).stdout
|
diff_out = Popen([realsvn] + argv, stdout=PIPE).stdout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user