##// END OF EJS Templates
Abort on empty username so specifying a username can be forced....
Thomas Arendsen Hein -
r4044:78a0dd93 default
parent child Browse files
Show More
@@ -345,12 +345,14 b' class ui(object):'
345 user = self.config("ui", "username")
345 user = self.config("ui", "username")
346 if user is None:
346 if user is None:
347 user = os.environ.get("EMAIL")
347 user = os.environ.get("EMAIL")
348 if not user:
348 if user is None:
349 try:
349 try:
350 user = '%s@%s' % (util.getuser(), socket.getfqdn())
350 user = '%s@%s' % (util.getuser(), socket.getfqdn())
351 self.warn(_("No username found, using '%s' instead\n") % user)
351 except KeyError:
352 except KeyError:
352 raise util.Abort(_("Please specify a username."))
353 pass
353 self.warn(_("No username found, using '%s' instead\n") % user)
354 if not user:
355 raise util.Abort(_("Please specify a username."))
354 return user
356 return user
355
357
356 def shortuser(self, user):
358 def shortuser(self, user):
@@ -24,5 +24,8 b' echo 1 > asdf'
24 hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
24 hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1
25 hg tip
25 hg tip
26 echo 123 > asdf
26 echo 123 > asdf
27 echo "[ui]" > .hg/hgrc
28 echo "username = " >> .hg/hgrc
29 hg commit -d '1000000 0' -m commit-1
27 rm .hg/hgrc
30 rm .hg/hgrc
28 hg commit -d '1000000 0' -m commit-1 2>&1 | sed -e "s/'[^']*'/user@host/"
31 hg commit -d '1000000 0' -m commit-1 2>&1 | sed -e "s/'[^']*'/user@host/"
@@ -22,4 +22,7 b' user: foo@bar.com'
22 date: Mon Jan 12 13:46:40 1970 +0000
22 date: Mon Jan 12 13:46:40 1970 +0000
23 summary: commit-1
23 summary: commit-1
24
24
25 abort: Please specify a username.
26 transaction abort!
27 rollback completed
25 No username found, using user@host instead
28 No username found, using user@host instead
General Comments 0
You need to be logged in to leave comments. Login now