diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1914,11 +1914,10 @@ def prev(ui, repo, **opts): 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 --git a/tests/test-mq-qnew b/tests/test-mq-qnew --- a/tests/test-mq-qnew +++ b/tests/test-mq-qnew @@ -54,3 +54,7 @@ echo b >> b 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 --git a/tests/test-mq-qnew.out b/tests/test-mq-qnew.out --- a/tests/test-mq-qnew.out +++ b/tests/test-mq-qnew.out @@ -32,3 +32,6 @@ diff --git a/d/b b/d/b @@ -1,1 +1,2 @@ b +b +% qnew -u with no username configured +From: blue +