##// 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 (hashes for the repository base and for tip) in archives created by
547 (hashes for the repository base and for tip) in archives created by
548 the hg archive command or downloaded via hgweb.
548 the hg archive command or downloaded via hgweb.
549 Default is true.
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 debug;;
556 debug;;
551 Print debugging information. True or False. Default is False.
557 Print debugging information. True or False. Default is False.
552 editor;;
558 editor;;
@@ -331,14 +331,16 b' class ui(object):'
331
331
332 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
332 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
333 and stop searching if one of these is set.
333 and stop searching if one of these is set.
334 If not found, use ($LOGNAME or $USER or $LNAME or
334 If not found and ui.askusername is True, ask the user, else use
335 $USERNAME) +"@full.hostname".
335 ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
336 """
336 """
337 user = os.environ.get("HGUSER")
337 user = os.environ.get("HGUSER")
338 if user is None:
338 if user is None:
339 user = self.config("ui", "username")
339 user = self.config("ui", "username")
340 if user is None:
340 if user is None:
341 user = os.environ.get("EMAIL")
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 if user is None:
344 if user is None:
343 try:
345 try:
344 user = '%s@%s' % (util.getuser(), socket.getfqdn())
346 user = '%s@%s' % (util.getuser(), socket.getfqdn())
General Comments 0
You need to be logged in to leave comments. Login now