diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -551,9 +551,13 @@ class queue: message.append(_("\nimported patch %s") % patchname) message = '\n'.join(message) - (patcherr, files, fuzz) = self.patch(repo, pf) - all_files.update(files) - patcherr = not patcherr + if ph.haspatch: + (patcherr, files, fuzz) = self.patch(repo, pf) + all_files.update(files) + patcherr = not patcherr + else: + self.ui.warn(_("patch %s is empty\n") % patchname) + patcherr, files, fuzz = 0, [], 0 if merge and files: # Mark as removed/merged and update dirstate parent info @@ -583,12 +587,8 @@ class queue: self.applied.append(statusentry(hex(n), patchname)) if patcherr: - if not ph.haspatch: - self.ui.warn(_("patch %s is empty\n") % patchname) - err = 0 - else: - self.ui.warn(_("patch failed, rejects left in working dir\n")) - err = 1 + self.ui.warn(_("patch failed, rejects left in working dir\n")) + err = 1 break if fuzz and strict: diff --git a/tests/test-mq-qdelete.out b/tests/test-mq-qdelete.out --- a/tests/test-mq-qdelete.out +++ b/tests/test-mq-qdelete.out @@ -30,6 +30,7 @@ abort: cannot delete revision 2 above ap now at: b abort: unknown revision 'c'! applying c +patch c is empty now at: c c 3 imported patch c diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -486,8 +486,6 @@ patch queue now empty abort: local changes found, refresh first % apply force, should not discard changes with empty patch applying empty -patch: **** Only garbage was found in the patch input. -patch failed, unable to continue (try -v) patch empty is empty now at: empty diff -r bf5fc3f07a0a hello.txt