patch: be more tolerant to diffstat failures (issue 865)
authorPatrick Mezard <pmezard@gmail.com>
Tue, 25 Dec 2007 22:21:51 +0100
changeset 5669 a0eb8a418442
parent 5668 ca4f10c76ea7
child 5670 840e2b315c1f
child 5692 1127fe12202a
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.
mercurial/patch.py
--- a/mercurial/patch.py	Tue Dec 25 14:05:26 2007 +0100
+++ b/mercurial/patch.py	Tue Dec 25 22:21:51 2007 +0100
@@ -1351,7 +1351,6 @@
             last = stat.pop()
             stat.insert(0, last)
             stat = ''.join(stat)
-            if stat.startswith('0 files'): raise ValueError
             return stat
         except: raise
     finally: