diff hgext/mq.py @ 9733:f16ec85f125c

mq: do not call ui.username unless it is necessary After changeset c63c336ee2f7, ui.username will abort by default if no username is set. It is therefore wrong to call ui.username when a username was provided on the command line.
author Martin Geisler <mg@lazybytes.net>
date Sat, 07 Nov 2009 00:13:05 +0100
parents 3f522d2fa633
children 87c92b260710
line wrap: on
line diff
--- a/hgext/mq.py	Fri Nov 06 22:54:51 2009 +0100
+++ b/hgext/mq.py	Sat Nov 07 00:13:05 2009 +0100
@@ -1914,11 +1914,10 @@
                      summary=opts.get('summary'))
 
 def setupheaderopts(ui, opts):
-    def do(opt, val):
-        if not opts[opt] and opts['current' + opt]:
-            opts[opt] = val
-    do('user', ui.username())
-    do('date', "%d %d" % util.makedate())
+    if not opts.get('user') and opts.get('currentuser'):
+        opts['user'] = ui.username()
+    if not opts.get('date') and opts.get('currentdate'):
+        opts['date'] = "%d %d" % util.makedate()
 
 def new(ui, repo, patch, *args, **opts):
     """create a new patch