changeset 5334:448eb46d4d84

mq: fix qrefresh -e with no patches applied
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 24 Sep 2007 19:00:11 -0300
parents 6e6a00a7bf75
children 88e931f74e8b
files hgext/mq.py tests/test-mq-qrefresh-replace-log-message tests/test-mq-qrefresh-replace-log-message.out
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Sep 24 19:00:11 2007 -0300
+++ b/hgext/mq.py	Mon Sep 24 19:00:11 2007 -0300
@@ -1607,6 +1607,9 @@
     q = repo.mq
     message = cmdutil.logmessage(opts)
     if opts['edit']:
+        if not q.applied:
+            ui.write(_("No patches applied\n"))
+            return 1
         if message:
             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
         patch = q.applied[-1].name
--- a/tests/test-mq-qrefresh-replace-log-message	Mon Sep 24 19:00:11 2007 -0300
+++ b/tests/test-mq-qrefresh-replace-log-message	Mon Sep 24 19:00:11 2007 -0300
@@ -8,6 +8,11 @@
 hg init
 hg qinit
 
+echo =======================
+echo "Should fail if no patches applied"
+hg qrefresh
+hg qrefresh -e
+
 hg qnew -m "First commit message" first-patch
 echo aaaa > file
 hg add file
--- a/tests/test-mq-qrefresh-replace-log-message.out	Mon Sep 24 19:00:11 2007 -0300
+++ b/tests/test-mq-qrefresh-replace-log-message.out	Mon Sep 24 19:00:11 2007 -0300
@@ -1,3 +1,7 @@
+=======================
+Should fail if no patches applied
+No patches applied
+No patches applied
 =======================
 Should display 'First commit message'
 description: