##// END OF EJS Templates
ui: add an option to prompt for the username when it isn't provided...
Benoit Boissinot -
r6862:7192876a default
parent child Browse files
Show More
@@ -547,6 +547,12 b' ui::'
547 547 (hashes for the repository base and for tip) in archives created by
548 548 the hg archive command or downloaded via hgweb.
549 549 Default is true.
550 askusername;;
551 Whether to prompt for a username when committing. If True, and
552 neither $HGUSER nor $EMAIL has been specified, then the user will
553 be prompted to enter a username. If no username is entered, the
554 default USER@HOST is used instead.
555 Default is False.
550 556 debug;;
551 557 Print debugging information. True or False. Default is False.
552 558 editor;;
@@ -331,14 +331,16 b' class ui(object):'
331 331
332 332 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
333 333 and stop searching if one of these is set.
334 If not found, use ($LOGNAME or $USER or $LNAME or
335 $USERNAME) +"@full.hostname".
334 If not found and ui.askusername is True, ask the user, else use
335 ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
336 336 """
337 337 user = os.environ.get("HGUSER")
338 338 if user is None:
339 339 user = self.config("ui", "username")
340 340 if user is None:
341 341 user = os.environ.get("EMAIL")
342 if user is None and self.configbool("ui", "askusername"):
343 user = self.prompt(_("Enter a commit username:"), default=None)
342 344 if user is None:
343 345 try:
344 346 user = '%s@%s' % (util.getuser(), socket.getfqdn())
General Comments 0
You need to be logged in to leave comments. Login now