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