##// 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 else:
109 else:
110 return self.parentui.configbool(section, name, default)
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 def configitems(self, section):
116 def configitems(self, section):
113 items = {}
117 items = {}
114 if self.parentui is not None:
118 if self.parentui is not None:
@@ -179,7 +183,8 b' class ui(object):'
179 and stop searching if one of these is set.
183 and stop searching if one of these is set.
180 Abort if found username is an empty string to force specifying
184 Abort if found username is an empty string to force specifying
181 the commit user elsewhere, e.g. with line option or repo hgrc.
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 user = os.environ.get("HGUSER")
189 user = os.environ.get("HGUSER")
185 if user is None:
190 if user is None:
@@ -187,10 +192,9 b' class ui(object):'
187 if user is None:
192 if user is None:
188 user = os.environ.get("EMAIL")
193 user = os.environ.get("EMAIL")
189 if user is None:
194 if user is None:
190 user = os.environ.get("LOGNAME") or os.environ.get("USERNAME")
195 try:
191 if user:
196 user = '%s@%s' % (getpass.getuser(), socket.getfqdn())
192 user = "%s@%s" % (user, socket.getfqdn())
197 except KeyError:
193 if not user:
194 raise util.Abort(_("Please specify a username."))
198 raise util.Abort(_("Please specify a username."))
195 return user
199 return user
196
200
General Comments 0
You need to be logged in to leave comments. Login now