change stash subcommands to require "--" prefix
This commit is contained in:
parent
cec02602a0
commit
ee592451b5
46
jsvn
46
jsvn
@ -1233,12 +1233,7 @@ def revert_h(argv, svn, out, config):
|
||||
break
|
||||
return RET_OK if did_something else RET_REEXEC
|
||||
|
||||
def stash_save_h(argv, svn, out, config):
|
||||
keep_wc = False
|
||||
options, args = getopt.getopt(argv, 'k')
|
||||
for opt, val in options:
|
||||
if opt == '-k':
|
||||
keep_wc = True
|
||||
def stash_save_h(args, svn, out, config, keep_wc):
|
||||
owd = os.getcwd()
|
||||
wc_dir = get_svn_wc_root(svn)
|
||||
os.chdir(wc_dir)
|
||||
@ -1380,12 +1375,7 @@ def stash_list_h(argv, svn, out, config):
|
||||
out.write('\n')
|
||||
return RET_OK
|
||||
|
||||
def stash_pop_h(argv, svn, out, config):
|
||||
keep = False
|
||||
options, args = getopt.getopt(argv, 'k')
|
||||
for opt, val in options:
|
||||
if opt == '-k':
|
||||
keep = True
|
||||
def stash_pop_h(args, svn, out, config, keep):
|
||||
owd = os.getcwd()
|
||||
wc_dir = get_svn_wc_root(svn)
|
||||
os.chdir(wc_dir)
|
||||
@ -1443,23 +1433,21 @@ def stash_drop_h(argv, svn, out, config):
|
||||
|
||||
def stash_h(argv, svn, out, config):
|
||||
argv = argv[1:] # strip 'stash' command
|
||||
action = 'save'
|
||||
if len(argv) >= 1:
|
||||
if not argv[0].startswith('-'):
|
||||
action = argv[0]
|
||||
argv = argv[1:]
|
||||
# now argv only contains options/arguments to the stash subcommand itself
|
||||
actions = {
|
||||
'save': stash_save_h,
|
||||
'list': stash_list_h,
|
||||
'pop': stash_pop_h,
|
||||
'show': stash_show_h,
|
||||
'drop': stash_drop_h
|
||||
}
|
||||
if action in actions:
|
||||
return actions[action](argv, svn, out, config)
|
||||
sys.stderr.write('Unknown action "%s"\n' % action)
|
||||
return RET_ERR
|
||||
opts, args = getopt.getopt(argv, 'k',
|
||||
['list', 'pop', 'show', 'drop'])
|
||||
keep = False
|
||||
for opt, arg in opts:
|
||||
if opt == '--list':
|
||||
return stash_list_h(args, svn, out, config)
|
||||
if opt == '--pop':
|
||||
return stash_pop_h(args, svn, out, config, keep)
|
||||
if opt == '--show':
|
||||
return stash_show_h(args, svn, out, config)
|
||||
if opt == '--drop':
|
||||
return stash_drop_h(args, svn, out, config)
|
||||
if opt == '-k':
|
||||
keep = True
|
||||
return stash_save_h(args, svn, out, config, keep)
|
||||
|
||||
def root_h(argv, svn, out, config):
|
||||
out.write(get_svn_root_url(svn) + '\n')
|
||||
|
Loading…
x
Reference in New Issue
Block a user