mq: fix traceback for qpush inexistant-patch with no patch applied
authorBenoit Allard <benoit@aeteurope.nl>
Fri, 16 Oct 2009 00:09:18 +0200
changeset 9590 07a62819b309
parent 9589 fdf0c375cdbf
child 9599 f3404b7f37ca
mq: fix traceback for qpush inexistant-patch with no patch applied
hgext/mq.py
tests/test-mq-qpush-fail
tests/test-mq-qpush-fail.out
--- a/hgext/mq.py	Wed Oct 14 20:55:39 2009 +0300
+++ b/hgext/mq.py	Fri Oct 16 00:09:18 2009 +0200
@@ -977,6 +977,8 @@
                 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")
--- a/tests/test-mq-qpush-fail	Wed Oct 14 20:55:39 2009 +0300
+++ b/tests/test-mq-qpush-fail	Fri Oct 16 00:09:18 2009 +0200
@@ -53,4 +53,10 @@
 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
--- a/tests/test-mq-qpush-fail.out	Wed Oct 14 20:55:39 2009 +0300
+++ b/tests/test-mq-qpush-fail.out	Fri Oct 16 00:09:18 2009 +0200
@@ -27,3 +27,8 @@
 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