stash: abort creating stash file if changes to binary files are present
This commit is contained in:
parent
50115bb998
commit
5f4a4c5a96
14
jsvn
14
jsvn
@ -814,18 +814,24 @@ def stash(argv, svn, out):
|
|||||||
fh = open(stash_fname, 'w')
|
fh = open(stash_fname, 'w')
|
||||||
proc = Popen([svn, 'diff'], stdout=PIPE)
|
proc = Popen([svn, 'diff'], stdout=PIPE)
|
||||||
wrote_something = False
|
wrote_something = False
|
||||||
|
found_binary_file = False
|
||||||
for line in iter(proc.stdout.readline, ''):
|
for line in iter(proc.stdout.readline, ''):
|
||||||
if len(line) > 0:
|
if re.match(r'Cannot.display..file.marked.as.a.binary.type',
|
||||||
wrote_something = True
|
line, flags=re.I):
|
||||||
|
found_binary_file = True
|
||||||
fh.write(line)
|
fh.write(line)
|
||||||
|
wrote_something = True
|
||||||
proc.wait()
|
proc.wait()
|
||||||
fh.close()
|
fh.close()
|
||||||
if wrote_something:
|
if found_binary_file:
|
||||||
|
out.write('Error: cannot stash with changes to binary files\n')
|
||||||
|
os.unlink(stash_fname)
|
||||||
|
elif wrote_something:
|
||||||
Popen([svn, 'revert', '--depth=infinity', '.'],
|
Popen([svn, 'revert', '--depth=infinity', '.'],
|
||||||
stdout=PIPE).wait()
|
stdout=PIPE).wait()
|
||||||
out.write('Created stash %d\n' % stash_idx)
|
out.write('Created stash %d\n' % stash_idx)
|
||||||
else:
|
else:
|
||||||
out.write('Nothing to stash!\n')
|
out.write('Error: no changes to stash!\n')
|
||||||
os.unlink(stash_fname)
|
os.unlink(stash_fname)
|
||||||
os.chdir(owd)
|
os.chdir(owd)
|
||||||
elif action == 'list':
|
elif action == 'list':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user