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