comparison mercurial/patch.py @ 5669:a0eb8a418442

patch: be more tolerant to diffstat failures (issue 865) Sometimes, revisions cannot be represented by a regular diff, only a git diff would capture binary files or permission changes. diffstat cannot handle git patches and will output "0 files changed" when fed with an empty diff. We cannot consider the latter to be an error, unless we rewrite diffstat to handle these correctly.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 25 Dec 2007 22:21:51 +0100
parents 8a8c341bd292
children 1127fe12202a 03f550f9b554
comparison
equal deleted inserted replaced
5668:ca4f10c76ea7 5669:a0eb8a418442
1349 stat = [] 1349 stat = []
1350 for line in fp: stat.append(line.lstrip()) 1350 for line in fp: stat.append(line.lstrip())
1351 last = stat.pop() 1351 last = stat.pop()
1352 stat.insert(0, last) 1352 stat.insert(0, last)
1353 stat = ''.join(stat) 1353 stat = ''.join(stat)
1354 if stat.startswith('0 files'): raise ValueError
1355 return stat 1354 return stat
1356 except: raise 1355 except: raise
1357 finally: 1356 finally:
1358 try: os.unlink(name) 1357 try: os.unlink(name)
1359 except: pass 1358 except: pass