add a checkout handler that defaults the working copy path to the last directory component before "/trunk"

This commit is contained in:
Josh Holtrop 2015-08-17 12:24:21 -04:00
parent 40b987911c
commit 3456e95135
2 changed files with 11 additions and 0 deletions

4
README
View File

@ -35,6 +35,10 @@ Implemented subcommands:
or a tag or branch name)
- if <source> is not given the HEAD of the current working-copy URL is used.
- also switch to the new branch if -s is given
checkout [options] [url] [wc_path]
- if a URL is given that ends with /trunk and no working copy path is given,
then the last directory component before "/trunk" is used as the working
copy path
clean [-x] {-n|-f} [path...]
- remove (or list) unversioned items
options:

7
jsvn
View File

@ -1650,6 +1650,12 @@ def url_h(argv, svn, out, config):
out.write(get_svn_url(svn, path) + '\n')
return RET_OK
def checkout_h(argv, svn, out, config):
if re.search(r'://.*/trunk$', argv[-1]):
argv += [argv[-1].split("/")[-2]]
Popen([svn] + argv, stdout=out).wait()
return RET_OK
def clean_h(argv, svn, out, config):
argv = argv[1:] # strip command
opts, args = getopt.getopt(argv, 'fnx',
@ -1787,6 +1793,7 @@ def do_cmd(argv, realsvn, config, expand=True):
'add': add_h,
'bisect': bisect_h,
'branch': branch_h,
'checkout': checkout_h,
'clean': clean_h,
'externals': externals_h,
'switch': switch_h,