[rfc] environment variables: why BZREMAIL but not BZR_EMAIL
John A Meinel
john at arbash-meinel.com
Thu May 11 01:39:36 BST 2006
Alexander Belchenko wrote:
> I wonder why almost all bzr-specific environment variables have prefix
> 'BZR_' (with underscore between BZR and next word) and only BZREMAIL has
> different naming rule.
>
> Let's see:
>
> BZR_EDITOR
> BZR_PLUGIN_PATH
> BZR_HOME
> BZR_DEBUG
>
> But:
>
> BZREMAIL
>
> I think having the same prefix for all bzr-specific names is easier for
> users to remember.
>
> I propose to check both BZR_EMAIL and BZREMAIL in config.py and mark
> BZREMAIL as deprecated in the next releases. Patch attached.
>
> --
> Alexander
>
>
Well, it used to be BZRPATH and BZREMAIL, but I do believe we are
switching to BZR_* stuff, so I'm +1 on the concept of changing it.
> ------------------------------------------------------------------------
>
> === modified file 'a/bzrlib/config.py'
> --- a/bzrlib/config.py
> +++ b/bzrlib/config.py
> @@ -159,7 +159,7 @@
>
> Something similar to 'Martin Pool <mbp at sourcefrog.net>'
>
> - $BZREMAIL can be set to override this, then
> + $BZR_EMAIL can be set to override this, then
> the concrete policy type is checked, and finally
> $EMAIL is examined.
> If none is found, a reasonable default is (hopefully)
> @@ -167,8 +167,15 @@
>
> TODO: Check it's reasonably well-formed.
> """
> + v = os.environ.get('BZR_EMAIL')
> + if v:
> + return v.decode(bzrlib.user_encoding)
> +
> v = os.environ.get('BZREMAIL')
> if v:
> + print ('WARNING: Usage of environment variable BZREMAIL '
> + 'is deprecated.\n'
> + 'Use BZR_EMAIL instead.\n')
> return v.decode(bzrlib.user_encoding)
>
> v = self._get_user_id()
>
>
Obviously we would need updated tests. Also I believe the proper way is
to use 'import warnings; warnings.warn' look at places that are
deprecated to get a feel for it.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060510/ad2e683f/attachment.pgp
More information about the bazaar
mailing list