##// END OF EJS Templates
add ui.has_config method.
Vadim Gelfer -
r2343:af81d877 default
parent child Browse files
Show More
@@ -109,6 +109,10 b' class ui(object):'
109 109 else:
110 110 return self.parentui.configbool(section, name, default)
111 111
112 def has_config(self, section):
113 '''tell whether section exists in config.'''
114 return self.cdata.has_section(section)
115
112 116 def configitems(self, section):
113 117 items = {}
114 118 if self.parentui is not None:
@@ -179,7 +183,8 b' class ui(object):'
179 183 and stop searching if one of these is set.
180 184 Abort if found username is an empty string to force specifying
181 185 the commit user elsewhere, e.g. with line option or repo hgrc.
182 If not found, use $LOGNAME or $USERNAME +"@full.hostname".
186 If not found, use ($LOGNAME or $USER or $LNAME or
187 $USERNAME) +"@full.hostname".
183 188 """
184 189 user = os.environ.get("HGUSER")
185 190 if user is None:
@@ -187,10 +192,9 b' class ui(object):'
187 192 if user is None:
188 193 user = os.environ.get("EMAIL")
189 194 if user is None:
190 user = os.environ.get("LOGNAME") or os.environ.get("USERNAME")
191 if user:
192 user = "%s@%s" % (user, socket.getfqdn())
193 if not user:
195 try:
196 user = '%s@%s' % (getpass.getuser(), socket.getfqdn())
197 except KeyError:
194 198 raise util.Abort(_("Please specify a username."))
195 199 return user
196 200
General Comments 0
You need to be logged in to leave comments. Login now