##// END OF EJS Templates
makes username mandatory
Benoit Boissinot -
r3466:8b55c0ba default
parent child Browse files
Show More
@@ -401,9 +401,8 ui::
401 401 username;;
402 402 The committer of a changeset created when running "commit".
403 403 Typically a person's name and email address, e.g. "Fred Widget
404 <fred@example.com>". Default is $EMAIL or username@hostname, unless
405 username is set to an empty string, which enforces specifying the
406 username manually.
404 <fred@example.com>". Default is $EMAIL. If no default is found,
405 the username have to be specified manually.
407 406 verbose;;
408 407 Increase the amount of output printed. True or False. Default is False.
409 408
@@ -226,10 +226,8 class ui(object):
226 226
227 227 Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
228 228 and stop searching if one of these is set.
229 Abort if found username is an empty string to force specifying
230 the commit user elsewhere, e.g. with line option or repo hgrc.
231 If not found, use ($LOGNAME or $USER or $LNAME or
232 $USERNAME) +"@full.hostname".
229 Abort if no username is found, to force specifying the commit user
230 with line option or repo hgrc.
233 231 """
234 232 user = os.environ.get("HGUSER")
235 233 if user is None:
@@ -237,10 +235,7 class ui(object):
237 235 if user is None:
238 236 user = os.environ.get("EMAIL")
239 237 if user is None:
240 try:
241 user = '%s@%s' % (util.getuser(), socket.getfqdn())
242 except KeyError:
243 raise util.Abort(_("Please specify a username."))
238 raise util.Abort(_("No default username available, use -u"))
244 239 return user
245 240
246 241 def shortuser(self, user):
@@ -519,20 +519,6 def is_win_9x():
519 519 except AttributeError:
520 520 return os.name == 'nt' and 'command' in os.environ.get('comspec', '')
521 521
522 getuser_fallback = None
523
524 def getuser():
525 '''return name of current user'''
526 try:
527 return getpass.getuser()
528 except ImportError:
529 # import of pwd will fail on windows - try fallback
530 if getuser_fallback:
531 return getuser_fallback()
532 # raised if win32api not available
533 raise Abort(_('user name not available - set USERNAME '
534 'environment variable'))
535
536 522 # Platform specific variants
537 523 if os.name == 'nt':
538 524 demandload(globals(), "msvcrt")
@@ -297,5 +297,3 class posixfile_nt(object):
297 297 win32file.SetEndOfFile(self.handle)
298 298 except pywintypes.error, err:
299 299 raise WinIOError(err)
300
301 getuser_fallback = win32api.GetUserName
@@ -10,3 +10,17 touch asdf
10 10 hg add asdf
11 11 hg commit -d '1000000 0' -m commit-1
12 12 hg tip
13
14 unset EMAIL
15 echo 1 > asdf
16 hg commit -d '1000000 0' -m commit-1
17 hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
18 hg tip
19 echo "[ui]" >> .hg/hgrc
20 echo "username = foobar <foo@bar.com>" >> .hg/hgrc
21 echo 12 > asdf
22 hg commit -d '1000000 0' -m commit-1
23 hg tip
24 echo 1 > asdf
25 hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
26 hg tip
@@ -4,3 +4,24 user: My Name <myname@example.com
4 4 date: Mon Jan 12 13:46:40 1970 +0000
5 5 summary: commit-1
6 6
7 abort: No default username available, use -u
8 transaction abort!
9 rollback completed
10 changeset: 1:2becd0bae6e6
11 tag: tip
12 user: foo@bar.com
13 date: Mon Jan 12 13:46:40 1970 +0000
14 summary: commit-1
15
16 changeset: 2:7a0176714f78
17 tag: tip
18 user: foobar <foo@bar.com>
19 date: Mon Jan 12 13:46:40 1970 +0000
20 summary: commit-1
21
22 changeset: 3:f9b58c5a6352
23 tag: tip
24 user: foo@bar.com
25 date: Mon Jan 12 13:46:40 1970 +0000
26 summary: commit-1
27
General Comments 0
You need to be logged in to leave comments. Login now