Show More
@@ -419,8 +419,7 b' ui::' | |||
|
419 | 419 | username;; |
|
420 | 420 | The committer of a changeset created when running "commit". |
|
421 | 421 | Typically a person's name and email address, e.g. "Fred Widget |
|
422 |
<fred@example.com>". Default is $EMAIL |
|
|
423 | configured username is empty, it has to be specified manually. | |
|
422 | <fred@example.com>". Default is $EMAIL or username@hostname. | |
|
424 | 423 | verbose;; |
|
425 | 424 | Increase the amount of output printed. True or False. Default is False. |
|
426 | 425 |
@@ -679,6 +679,7 b' class localrepository(repo.repository):' | |||
|
679 | 679 | if text: |
|
680 | 680 | edittext.append(text) |
|
681 | 681 | edittext.append("") |
|
682 | edittext.append("HG: user: %s" % user) | |
|
682 | 683 | if p2 != nullid: |
|
683 | 684 | edittext.append("HG: branch merge") |
|
684 | 685 | edittext.extend(["HG: changed %s" % f for f in changed]) |
@@ -336,8 +336,8 b' class ui(object):' | |||
|
336 | 336 | |
|
337 | 337 | Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL |
|
338 | 338 | and stop searching if one of these is set. |
|
339 | Abort if no username is found, to force specifying the commit user | |
|
340 | with line option or repo hgrc. | |
|
339 | If not found, use ($LOGNAME or $USER or $LNAME or | |
|
340 | $USERNAME) +"@full.hostname". | |
|
341 | 341 | """ |
|
342 | 342 | user = os.environ.get("HGUSER") |
|
343 | 343 | if user is None: |
@@ -345,12 +345,11 b' class ui(object):' | |||
|
345 | 345 | if user is None: |
|
346 | 346 | user = os.environ.get("EMAIL") |
|
347 | 347 | if not user: |
|
348 | self.status(_("Please choose a commit username to be recorded " | |
|
349 | "in the changelog via\ncommand line option " | |
|
350 | '(-u "First Last <email@example.com>"), in the\n' | |
|
351 | "configuration files (hgrc), or by setting the " | |
|
352 | "EMAIL environment variable.\n\n")) | |
|
353 | raise util.Abort(_("No commit username specified!")) | |
|
348 | try: | |
|
349 | user = '%s@%s' % (util.getuser(), socket.getfqdn()) | |
|
350 | except KeyError: | |
|
351 | raise util.Abort(_("Please specify a username.")) | |
|
352 | self.warn(_("No username found, using '%s' instead\n" % user)) | |
|
354 | 353 | return user |
|
355 | 354 | |
|
356 | 355 | def shortuser(self, user): |
@@ -535,6 +535,20 b' def is_win_9x():' | |||
|
535 | 535 | except AttributeError: |
|
536 | 536 | return os.name == 'nt' and 'command' in os.environ.get('comspec', '') |
|
537 | 537 | |
|
538 | getuser_fallback = None | |
|
539 | ||
|
540 | def getuser(): | |
|
541 | '''return name of current user''' | |
|
542 | try: | |
|
543 | return getpass.getuser() | |
|
544 | except ImportError: | |
|
545 | # import of pwd will fail on windows - try fallback | |
|
546 | if getuser_fallback: | |
|
547 | return getuser_fallback() | |
|
548 | # raised if win32api not available | |
|
549 | raise Abort(_('user name not available - set USERNAME ' | |
|
550 | 'environment variable')) | |
|
551 | ||
|
538 | 552 | def username(uid=None): |
|
539 | 553 | """Return the name of the user with the given uid. |
|
540 | 554 |
@@ -297,3 +297,5 b' 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 |
@@ -12,8 +12,7 b" hg commit -d '1000000 0' -m commit-1" | |||
|
12 | 12 | hg tip |
|
13 | 13 | |
|
14 | 14 | unset EMAIL |
|
15 | echo 1 > asdf | |
|
16 | hg commit -d '1000000 0' -m commit-1 | |
|
15 | echo 1234 > asdf | |
|
17 | 16 | hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 |
|
18 | 17 | hg tip |
|
19 | 18 | echo "[ui]" >> .hg/hgrc |
@@ -24,3 +23,6 b' hg tip' | |||
|
24 | 23 | echo 1 > asdf |
|
25 | 24 | hg commit -d '1000000 0' -u "foo@bar.com" -m commit-1 |
|
26 | 25 | hg tip |
|
26 | echo 123 > asdf | |
|
27 | rm .hg/hgrc | |
|
28 | hg commit -d '1000000 0' -m commit-1 2>&1 | sed -e "s/[^ \t]*@[^ \t]*/user@host/" |
@@ -4,28 +4,22 b' 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 | Please choose a commit username to be recorded in the changelog via | |
|
8 | command line option (-u "First Last <email@example.com>"), in the | |
|
9 | configuration files (hgrc), or by setting the EMAIL environment variable. | |
|
10 | ||
|
11 | abort: No commit username specified! | |
|
12 | transaction abort! | |
|
13 | rollback completed | |
|
14 | changeset: 1:2becd0bae6e6 | |
|
7 | changeset: 1:4997f15a1b24 | |
|
15 | 8 | tag: tip |
|
16 | 9 | user: foo@bar.com |
|
17 | 10 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
18 | 11 | summary: commit-1 |
|
19 | 12 | |
|
20 |
changeset: 2:7 |
|
|
13 | changeset: 2:72b8012b424e | |
|
21 | 14 | tag: tip |
|
22 | 15 | user: foobar <foo@bar.com> |
|
23 | 16 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
24 | 17 | summary: commit-1 |
|
25 | 18 | |
|
26 |
changeset: 3: |
|
|
19 | changeset: 3:35ff3067bedd | |
|
27 | 20 | tag: tip |
|
28 | 21 | user: foo@bar.com |
|
29 | 22 | date: Mon Jan 12 13:46:40 1970 +0000 |
|
30 | 23 | summary: commit-1 |
|
31 | 24 | |
|
25 | No username found, using user@host instead |
General Comments 0
You need to be logged in to leave comments.
Login now