# HG changeset patch # User Patrick Mezard # Date 2007-12-17 21:19:21 # Node ID a583117b536ade82c9a2191a43c57362e7eed1eb # Parent 2079faccb4081c851c49a4634671b07e5f8f459d patch: move NoHunk detection up with parsing code diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1008,12 +1008,13 @@ def applydiff(ui, fp, changed, strip=1, 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):