jsvn: add "externals" subcommand
This commit is contained in:
parent
2e81f0eb25
commit
c5e7f25f40
14
jsvn
14
jsvn
@ -41,6 +41,8 @@
|
||||
# - with no switches, set svn:needs-lock to '*' for file[s]
|
||||
# - with --remove, remove svn:needs-lock' for file[s]
|
||||
# - with --status, prepended '*' for those with svn:needs-lock set
|
||||
# externals
|
||||
# - print a list of the externals in the repository
|
||||
#
|
||||
# The following subcommands are executed using their native handler, but
|
||||
# have their output simplified and/or colorized:
|
||||
@ -59,6 +61,7 @@ import re
|
||||
import time
|
||||
from subprocess import *
|
||||
|
||||
STATUS_LINE_REGEX = r'[ACDIMRX?!~ ][CM ][L ][+ ][SX ][KOTB ]'
|
||||
###########################################################################
|
||||
# Subcommand Handler Return Values #
|
||||
###########################################################################
|
||||
@ -558,7 +561,7 @@ def status(argv, svn, out):
|
||||
if not external_printed:
|
||||
out.write("\nExternal '%s':\n" % external)
|
||||
external_printed = True
|
||||
if re.match(r'[ACDIMRX?!~ ][CM ][L ][+ ][SX ][KOTB ]', line):
|
||||
if re.match(STATUS_LINE_REGEX, line):
|
||||
action = line[0]
|
||||
if action == 'A' or action == 'M':
|
||||
ansi_color(out, 'green')
|
||||
@ -576,6 +579,14 @@ def status(argv, svn, out):
|
||||
out.write(line)
|
||||
return RET_OK
|
||||
|
||||
def externals(argv, svn, out):
|
||||
pout = Popen([svn, 'status'], stdout=PIPE).stdout
|
||||
for line in iter(pout.readline, ''):
|
||||
if re.match(STATUS_LINE_REGEX, line):
|
||||
if line[0] == 'X':
|
||||
out.write(line[8:])
|
||||
return RET_OK
|
||||
|
||||
def root(argv, svn, out):
|
||||
out.write(getSVNRoot(svn) + '\n')
|
||||
return RET_OK
|
||||
@ -613,6 +624,7 @@ def main(argv):
|
||||
handlers = {
|
||||
'branch': branch,
|
||||
'branches': branch,
|
||||
'externals': externals,
|
||||
'switch': switch,
|
||||
'sw': switch,
|
||||
'merge': merge,
|
||||
|
Loading…
x
Reference in New Issue
Block a user