changeset 11575:a5903e612f07

mq: evaluate --user before invoking editor with -e (issue2289)
author Brendan Cully <brendan@kublai.com>
date Thu, 15 Jul 2010 10:41:41 -0700
parents 6381fa7bfa53
children 98c874a929f1
files hgext/mq.py tests/test-mq-qnew tests/test-mq-qnew.out
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu Jul 15 14:41:22 2010 +0200
+++ b/hgext/mq.py	Thu Jul 15 10:41:41 2010 -0700
@@ -1999,7 +1999,7 @@
     """
     msg = cmdutil.logmessage(opts)
     def getmsg():
-        return ui.edit(msg, ui.username())
+        return ui.edit(msg, opts['user'] or ui.username())
     q = repo.mq
     opts['msg'] = msg
     if opts.get('edit'):
--- a/tests/test-mq-qnew	Thu Jul 15 14:41:22 2010 +0200
+++ b/tests/test-mq-qnew	Thu Jul 15 10:41:41 2010 -0700
@@ -70,6 +70,10 @@
     HGUSER= hg qnew -u blue red
     catpatch ../.hg/patches/red
 
+    echo '% qnew -e -u with no username configured'
+    HGUSER= hg qnew -e -u chartreuse fucsia
+    catpatch ../.hg/patches/fucsia
+
     echo '% fail when trying to import a merge'
     hg init merge
     cd merge
--- a/tests/test-mq-qnew.out	Thu Jul 15 14:41:22 2010 +0200
+++ b/tests/test-mq-qnew.out	Thu Jul 15 10:41:41 2010 -0700
@@ -42,6 +42,9 @@
 % qnew -u with no username configured
 From: blue
 
+% qnew -e -u with no username configured
+From: chartreuse
+
 % fail when trying to import a merge
 adding a
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -101,6 +104,10 @@
 # HG changeset patch
 # Parent 
 # User blue
+% qnew -e -u with no username configured
+# HG changeset patch
+# Parent 
+# User chartreuse
 % fail when trying to import a merge
 adding a
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved