detect when there is nothing to stash - fix #9
This commit is contained in:
parent
09a6f91f49
commit
50115bb998
18
jsvn
18
jsvn
@ -812,12 +812,22 @@ def stash(argv, svn, out):
|
||||
stash_idx = get_next_stash_idx(svn)
|
||||
stash_fname = get_stash_fname(svn, stash_idx)
|
||||
fh = open(stash_fname, 'w')
|
||||
Popen([svn, 'diff'], stdout=fh).wait()
|
||||
proc = Popen([svn, 'diff'], stdout=PIPE)
|
||||
wrote_something = False
|
||||
for line in iter(proc.stdout.readline, ''):
|
||||
if len(line) > 0:
|
||||
wrote_something = True
|
||||
fh.write(line)
|
||||
proc.wait()
|
||||
fh.close()
|
||||
Popen([svn, 'revert', '--depth=infinity', '.'],
|
||||
stdout=PIPE).wait()
|
||||
if wrote_something:
|
||||
Popen([svn, 'revert', '--depth=infinity', '.'],
|
||||
stdout=PIPE).wait()
|
||||
out.write('Created stash %d\n' % stash_idx)
|
||||
else:
|
||||
out.write('Nothing to stash!\n')
|
||||
os.unlink(stash_fname)
|
||||
os.chdir(owd)
|
||||
out.write('Created stash %d\n' % stash_idx)
|
||||
elif action == 'list':
|
||||
stash_ids = get_stash_ids(svn)
|
||||
for si in reversed(stash_ids):
|
||||
|
Loading…
x
Reference in New Issue
Block a user