# HG changeset patch # User Martin Geisler # Date 1257549185 -3600 # Node ID f16ec85f125c8d7caf4cfdf51701a1fc070ca28d # Parent 092bcf431562fc2775cc6dc1142c6fa15d970a22 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. diff -r 092bcf431562 -r f16ec85f125c hgext/mq.py --- 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 diff -r 092bcf431562 -r f16ec85f125c tests/test-mq-qnew --- a/tests/test-mq-qnew Fri Nov 06 22:54:51 2009 +0100 +++ b/tests/test-mq-qnew Sat Nov 07 00:13:05 2009 +0100 @@ -54,3 +54,7 @@ hg st hg qnew -g -f p cat ../.hg/patches/p + +echo '% qnew -u with no username configured' +HGUSER= hg qnew -u blue red +cat ../.hg/patches/red diff -r 092bcf431562 -r f16ec85f125c tests/test-mq-qnew.out --- a/tests/test-mq-qnew.out Fri Nov 06 22:54:51 2009 +0100 +++ b/tests/test-mq-qnew.out Sat Nov 07 00:13:05 2009 +0100 @@ -32,3 +32,6 @@ @@ -1,1 +1,2 @@ b +b +% qnew -u with no username configured +From: blue +