Bug 3342 - ui.username expansion does not work for $HOST
Summary: ui.username expansion does not work for $HOST
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-29 15:29 UTC by fms
Modified: 2012-05-13 04:55 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fms 2012-03-29 15:29 UTC
Reproducible with 2.1.1 on OS X and Debian Squeeze.  Other environment
variables seem to be expanded properly.

[fms@levo] ~:pts/1 % hg --config 'ui.username=$HOST' showconfig|grep user
smtp.username=fsiler@gmail.com
trusted.users=fms
ui.username=$HOST
[fms@levo] ~:pts/1 % hg --version
Mercurial Distributed SCM (version 2.1.1)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2012 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[fms@levo] ~:pts/1 % uname -a
Linux levo 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012 x86_64 GNU/Linux
Comment 1 fms 2012-03-29 15:46 UTC
Interesting: bug is more expansive when using --config instead of in config
file.  $USER, $TZ, et al are expanded when ui.username is specified in
config file, but on command line, hg does not expand any variables.
Comment 2 Matt Mackall 2012-03-29 20:05 UTC
Variable expansion is only done when config value are used (not for
display). Your test below is inconclusive.
Comment 3 fms 2012-03-29 20:27 UTC
~/.hgrc:
[ui]
username = Franklin Siler <fms@silerfamily.net> (from $USER on $HOST)


Below- commit header as it appears in $EDITOR:
HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: Franklin Siler <fms@silerfamily.net> (from fms on $HOST)
Comment 4 Matt Mackall 2012-03-29 20:33 UTC
Consult "env | grep HOST", please.
Comment 5 fms 2012-03-29 20:34 UTC
another example header with .hgrc:
[ui]
username = Franklin Siler <fms@silerfamily.net> (from $USER on $HOST in
$PWD, editor $EDITOR, timezone $TZ)

sample commit header:

HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: Franklin Siler <fms@silerfamily.net> (from fms on $HOST in
/Users/fms, editor vim, timezone America/Chicago)
Comment 6 Bugzilla 2012-05-12 09:29 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:29 EDT  ---

This bug was previously known as _bug_ 3341 at http://mercurial.selenic.com/bts/issue3341