##// END OF EJS Templates
Adapted behaviour of ui.username() to documentation and mention it explicitly:...
Thomas Arendsen Hein -
r1985:c5776890 default
parent child Browse files
Show More
@@ -257,7 +257,9 b' ui::'
257 257 username;;
258 258 The committer of a changeset created when running "commit".
259 259 Typically a person's name and email address, e.g. "Fred Widget
260 <fred@example.com>". Default is $EMAIL or username@hostname.
260 <fred@example.com>". Default is $EMAIL or username@hostname, unless
261 username is set to an empty string, which enforces specifying the
262 username manually.
261 263 verbose;;
262 264 Increase the amount of output printed. True or False. Default is False.
263 265
@@ -141,12 +141,26 b' class ui(object):'
141 141 return ret
142 142
143 143 def username(self):
144 return (os.environ.get("HGUSER") or
145 self.config("ui", "username") or
146 os.environ.get("EMAIL") or
147 (os.environ.get("LOGNAME",
148 os.environ.get("USERNAME", "unknown"))
149 + '@' + socket.getfqdn()))
144 """Return default username to be used in commits.
145
146 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
147 and stop searching if one of these is set.
148 Abort if found username is an empty string to force specifying
149 the commit user elsewhere, e.g. with line option or repo hgrc.
150 If not found, use $LOGNAME or $USERNAME +"@full.hostname".
151 """
152 user = os.environ.get("HGUSER")
153 if user is None:
154 user = self.config("ui", "username")
155 if user is None:
156 user = os.environ.get("EMAIL")
157 if user is None:
158 user = os.environ.get("LOGNAME") or os.environ.get("USERNAME")
159 if user:
160 user = "%s@%s" % (user, socket.getfqdn())
161 if not user:
162 raise util.Abort(_("Please specify a username."))
163 return user
150 164
151 165 def shortuser(self, user):
152 166 """Return a short representation of a user name or email address."""
General Comments 0
You need to be logged in to leave comments. Login now