[PATCH] mq: Fix message after failing qpush

Mads Kiilerich mads at kiilerich.com
Tue Jan 27 17:40:30 CST 2009


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1233099615 -3600
# Node ID 59c14e5745ef7d387a485f0a77142e4d8673051e
# Parent  5d25b2f59adeca72930be5a8f30f785e1edabb3d
mq: Fix message after failing qpush

If a user somehow ended up with a reference to a missing patch file in his
.hg/patches/series file then he would get a confusing error message when he
tried to push, telling him to refresh good top-most applied-patch.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -960,11 +960,11 @@
                         util.unlink(repo.wjoin(f))
                 self.ui.warn(_('done\n'))
                 raise
-            top = self.applied[-1].name
             if ret[0]:
                 self.ui.write(_("errors during apply, please fix and "
-                                "refresh %s\n") % top)
+                                "push again\n"))
             else:
+                top = self.applied[-1].name
                 self.ui.write(_("now at: %s\n") % top)
             return ret[0]
         finally:
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
@@ -41,3 +41,12 @@
 
 echo '% bar should be gone; other unknown/ignored files should still be around'
 hg status -A
+
+echo '% preparing qpush of a missing patch'
+hg qpop -a
+hg qpush
+rm .hg/patches/patch2
+echo '% now we expect the push to fail, but it should NOT complain about patch1'
+hg qpush
+
+true # really!
\ No newline at end of file
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
@@ -17,3 +17,11 @@
 ? untracked-file
 I .hgignore
 C foo
+% preparing qpush of a missing patch
+no patches applied
+applying patch1
+now at: patch1
+% now we expect the push to fail, but it should NOT complain about patch1
+applying patch2
+Unable to read patch2
+errors during apply, please fix and push again


More information about the Mercurial-devel mailing list