patch: move NoHunk detection up with parsing code
authorPatrick Mezard <pmezard@gmail.com>
Mon, 17 Dec 2007 22:19:21 +0100
changeset 5649 a583117b536a
parent 5648 2079faccb408
child 5650 5d3e2f918d65
patch: move NoHunk detection up with parsing code
mercurial/patch.py
--- 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):