[Pkg-bazaar-commits] ./bzr/unstable r258: - Take email from ~/.bzr.conf/email
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 07:43:55 UTC 2009
------------------------------------------------------------
revno: 258
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-04-15 12:34:07 +1000
message:
- Take email from ~/.bzr.conf/email
modified:
bzrlib/osutils.py
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2005-04-15 01:36:53 +0000
+++ b/bzrlib/osutils.py 2005-04-15 02:34:07 +0000
@@ -129,6 +129,16 @@
'sha1': s.hexdigest()}
+def config_dir():
+ """Return per-user configuration directory.
+
+ By default this is ~/.bzr.conf/
+
+ TODO: Global option --config-dir to override this.
+ """
+ return os.path.expanduser("~/.bzr.conf")
+
+
def _auto_user_id():
"""Calculate automatic user identification.
@@ -166,12 +176,16 @@
def _get_user_id():
+ """Return the full user id from a file or environment variable.
+
+ TODO: Allow taking this from a file in the branch directory too
+ for per-branch ids."""
v = os.environ.get('BZREMAIL')
if v:
return v.decode(bzrlib.user_encoding)
try:
- return (open(os.path.expanduser("~/.bzr.email"))
+ return (open(os.path.join(config_dir(), "email"))
.read()
.decode(bzrlib.user_encoding)
.rstrip("\r\n"))
@@ -192,9 +206,6 @@
Something similar to 'Martin Pool <mbp at sourcefrog.net>'
TODO: Check it's reasonably well-formed.
-
- TODO: Allow taking it from a dotfile to help people on windows
- who can't easily set variables.
"""
v = _get_user_id()
if v:
More information about the Pkg-bazaar-commits
mailing list