add -k to stash pop to allow keeping stash object - close #13
This commit is contained in:
parent
fd8702af29
commit
c43a3bd5e9
4
README
4
README
@ -67,9 +67,9 @@ Implemented subcommands:
|
|||||||
- this only works with text files, not binary files
|
- this only works with text files, not binary files
|
||||||
list:
|
list:
|
||||||
- show a list of all stash objects
|
- show a list of all stash objects
|
||||||
pop [id]:
|
pop [-k] [id]:
|
||||||
- apply the stash object <id> back to the working copy
|
- apply the stash object <id> back to the working copy
|
||||||
- the stash object is removed if it was successfully applied
|
- the stash object is removed unless -k (keep) given
|
||||||
- <id> defaults to the newest stash object created
|
- <id> defaults to the newest stash object created
|
||||||
show [id]:
|
show [id]:
|
||||||
- display the diff stored in stash with ID <id>
|
- display the diff stored in stash with ID <id>
|
||||||
|
12
jsvn
12
jsvn
@ -964,20 +964,26 @@ def stash(argv, svn, out):
|
|||||||
out.write(')')
|
out.write(')')
|
||||||
out.write('\n')
|
out.write('\n')
|
||||||
elif action == 'pop':
|
elif action == 'pop':
|
||||||
|
keep = False
|
||||||
|
options, args = getopt.getopt(argv, 'k')
|
||||||
|
for opt, val in options:
|
||||||
|
if opt == '-k':
|
||||||
|
keep = True
|
||||||
owd = os.getcwd()
|
owd = os.getcwd()
|
||||||
wc_dir = get_svn_wc_root(svn)
|
wc_dir = get_svn_wc_root(svn)
|
||||||
os.chdir(wc_dir)
|
os.chdir(wc_dir)
|
||||||
stash_ids = get_stash_ids(svn)
|
stash_ids = get_stash_ids(svn)
|
||||||
if len(stash_ids) > 0:
|
if len(stash_ids) > 0:
|
||||||
stash_idx = stash_ids[-1]
|
stash_idx = stash_ids[-1]
|
||||||
if len(argv) >= 1:
|
if len(args) >= 1:
|
||||||
stash_idx = int(argv[0])
|
stash_idx = int(args[0])
|
||||||
stash_fname = get_stash_fname(svn, stash_idx)
|
stash_fname = get_stash_fname(svn, stash_idx)
|
||||||
p = Popen([svn, 'patch', stash_fname], stdout=PIPE)
|
p = Popen([svn, 'patch', stash_fname], stdout=PIPE)
|
||||||
filter_update(p.stdout, out)
|
filter_update(p.stdout, out)
|
||||||
rc = p.wait()
|
rc = p.wait()
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
os.unlink(stash_fname)
|
if not keep:
|
||||||
|
os.unlink(stash_fname)
|
||||||
out.write('Popped stash %d\n' % stash_idx)
|
out.write('Popped stash %d\n' % stash_idx)
|
||||||
else:
|
else:
|
||||||
out.write('Error popping stash %d\n' % stash_idx)
|
out.write('Error popping stash %d\n' % stash_idx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user