# HG changeset patch # User Alexis S. L. Carvalho # Date 1190671211 10800 # Node ID 448eb46d4d84810671e2be1e515ec0a74c475917 # Parent 6e6a00a7bf75cc3f178080e5153ab6827c7da7ef mq: fix qrefresh -e with no patches applied diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1607,6 +1607,9 @@ def refresh(ui, repo, *pats, **opts): 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 diff --git a/tests/test-mq-qrefresh-replace-log-message b/tests/test-mq-qrefresh-replace-log-message --- a/tests/test-mq-qrefresh-replace-log-message +++ b/tests/test-mq-qrefresh-replace-log-message @@ -8,6 +8,11 @@ echo "mq=" >> $HGRCPATH 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 diff --git a/tests/test-mq-qrefresh-replace-log-message.out b/tests/test-mq-qrefresh-replace-log-message.out --- a/tests/test-mq-qrefresh-replace-log-message.out +++ b/tests/test-mq-qrefresh-replace-log-message.out @@ -1,3 +1,7 @@ +======================= +Should fail if no patches applied +No patches applied +No patches applied ======================= Should display 'First commit message' description: