comparison mercurial/commands.py @ 9734:36c388a1aa51

commands: call ui.username carefully in debuginstall After c63c336ee2f7, 'hg debuginstall' would abort halfway through if no username was set. We now catch and display the exception instead.
author Martin Geisler <mg@lazybytes.net>
date Sat, 07 Nov 2009 01:46:27 +0100
parents 3f522d2fa633
children 2ebe679fec21
comparison
equal deleted inserted replaced
9733:f16ec85f125c 9734:36c388a1aa51
1027 ui.write(_(" (specify a commit editor in your .hgrc file)\n")) 1027 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
1028 problems += 1 1028 problems += 1
1029 1029
1030 # check username 1030 # check username
1031 ui.status(_("Checking username...\n")) 1031 ui.status(_("Checking username...\n"))
1032 user = os.environ.get("HGUSER") 1032 try:
1033 if user is None: 1033 user = ui.username()
1034 user = ui.config("ui", "username") 1034 except util.Abort, e:
1035 if user is None: 1035 ui.write(" %s\n" % e)
1036 user = os.environ.get("EMAIL")
1037 if not user:
1038 ui.warn(" ")
1039 ui.username()
1040 ui.write(_(" (specify a username in your .hgrc file)\n")) 1036 ui.write(_(" (specify a username in your .hgrc file)\n"))
1037 problems += 1
1041 1038
1042 if not problems: 1039 if not problems:
1043 ui.status(_("No problems detected\n")) 1040 ui.status(_("No problems detected\n"))
1044 else: 1041 else:
1045 ui.write(_("%s problems detected," 1042 ui.write(_("%s problems detected,"