[PATCH stable]mq: fix traceback when qpush inexistant-patch with no patch applied

Benoît Allard benoit at aeteurope.nl
Tue Oct 6 08:35:06 CDT 2009


Here it is. I still prefer the first version as that one does a return 
at two places.

# HG changeset patch
# User Benoit Allard <benoit at aeteurope.nl>
# Date 1254530194 -7200
# Node ID ba92b3dbb9a840cb66483cd3cf4c3abd1a559b94
# Parent  53a95a74481248a92ea4faf10c302d1e948b7968
mq: fix traceback for qpush inexistant-patch with no patch applied

diff -r 53a95a744812 -r ba92b3dbb9a8 hgext/mq.py
--- a/hgext/mq.py	Sun Oct 04 23:16:54 2009 +0200
+++ b/hgext/mq.py	Sat Oct 03 02:36:34 2009 +0200
@@ -997,6 +997,8 @@
                  self.ui.warn(_('done\n'))
                  raise

+            if len(self.applied) == 0:
+                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 -r 53a95a744812 -r ba92b3dbb9a8 tests/test-mq-qpush-fail
--- a/tests/test-mq-qpush-fail	Sun Oct 04 23:16:54 2009 +0200
+++ b/tests/test-mq-qpush-fail	Sat Oct 03 02:36:34 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
diff -r 53a95a744812 -r ba92b3dbb9a8 tests/test-mq-qpush-fail.out
--- a/tests/test-mq-qpush-fail.out	Sun Oct 04 23:16:54 2009 +0200
+++ b/tests/test-mq-qpush-fail.out	Sat Oct 03 02:36:34 2009 +0200
@@ -30,3 +30,9 @@
  applying patch2
  unable to read patch2
  now at: patch1
+% preparing qpush of missing patch with no patch applied
+popping patch1
+patch queue now empty
+% qpush should fail the same way as below
+applying patch1
+unable to read patch1


More information about the Mercurial-devel mailing list