changeset 5649:a583117b536a

patch: move NoHunk detection up with parsing code
author Patrick Mezard <pmezard@gmail.com>
date Mon, 17 Dec 2007 22:19:21 +0100
parents 2079faccb408
children 5d3e2f918d65
files mercurial/patch.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Dec 17 13:45:30 2007 +0100
+++ b/mercurial/patch.py	Mon Dec 17 22:19:21 2007 +0100
@@ -1008,12 +1008,13 @@
         if rejmerge:
             rejmerge(current_file)
         rejects += len(current_file.rej)
+
+    if not rejects and hunknum == 0 and dopatch and not gitworkdone:
+        raise NoHunks
     if updatedir and git:
         updatedir(gitpatches)
     if rejects:
         return -1
-    if hunknum == 0 and dopatch and not gitworkdone:
-        raise NoHunks
     return err
 
 def diffopts(ui, opts={}, untrusted=False):