diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -977,6 +977,8 @@ class queue(object): self.ui.warn(_('done\n')) raise + if not self.applied: + return ret[0] top = self.applied[-1].name if ret[0] and ret[0] > 1: msg = _("errors during apply, please fix and refresh %s\n") diff --git a/tests/test-mq-qpush-fail b/tests/test-mq-qpush-fail --- a/tests/test-mq-qpush-fail +++ b/tests/test-mq-qpush-fail @@ -53,4 +53,10 @@ rm .hg/patches/patch2 echo '% now we expect the push to fail, but it should NOT complain about patch1' hg qpush +echo '% preparing qpush of missing patch with no patch applied' +hg qpop -a +rm .hg/patches/patch1 +echo '% qpush should fail the same way as below' +hg qpush + true # happy ending diff --git a/tests/test-mq-qpush-fail.out b/tests/test-mq-qpush-fail.out --- a/tests/test-mq-qpush-fail.out +++ b/tests/test-mq-qpush-fail.out @@ -27,3 +27,8 @@ now at: patch1 applying patch2 unable to read patch2 now at: patch1 +% preparing qpush of missing patch with no patch applied +patch queue now empty +% qpush should fail the same way as below +applying patch1 +unable to read patch1