comparison mercurial/ui.py @ 3415:ec6f400cff4d

Use a case-sensitive version of SafeConfigParser everywhere This change has the potential to break existing setups, but the current behaviour (the keys in configuration files are always lower-cased) can bite us in a few places: - no way to use a Command in [defaults] - hgext.Extension doesn't work in [extensions] - you can't use an Upper/case/PATH in the [paths] section of hgweb.config - you can't (easily) protect paths with upper-case letters with the acl extension - you can't specify a /Path/TO/a/rEPO in the [reposubs] section for the notify extension
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 16 Oct 2006 15:38:53 -0300
parents 9e834d039681
children 5ee5a0fec904
comparison
equal deleted inserted replaced
3414:9b1c126b74cd 3415:ec6f400cff4d
9 from demandload import * 9 from demandload import *
10 demandload(globals(), "errno getpass os re socket sys tempfile") 10 demandload(globals(), "errno getpass os re socket sys tempfile")
11 demandload(globals(), "ConfigParser traceback util") 11 demandload(globals(), "ConfigParser traceback util")
12 12
13 def dupconfig(orig): 13 def dupconfig(orig):
14 new = ConfigParser.SafeConfigParser(orig.defaults()) 14 new = util.configparser(orig.defaults())
15 updateconfig(orig, new) 15 updateconfig(orig, new)
16 return new 16 return new
17 17
18 def updateconfig(source, dest): 18 def updateconfig(source, dest):
19 for section in source.sections(): 19 for section in source.sections():
35 self.quiet = quiet 35 self.quiet = quiet
36 self.verbose = verbose 36 self.verbose = verbose
37 self.debugflag = debug 37 self.debugflag = debug
38 self.interactive = interactive 38 self.interactive = interactive
39 self.traceback = traceback 39 self.traceback = traceback
40 self.cdata = ConfigParser.SafeConfigParser() 40 self.cdata = util.configparser()
41 self.readconfig(util.rcpath()) 41 self.readconfig(util.rcpath())
42 self.updateopts(verbose, debug, quiet, interactive) 42 self.updateopts(verbose, debug, quiet, interactive)
43 else: 43 else:
44 # parentui may point to an ui object which is already a child 44 # parentui may point to an ui object which is already a child
45 self.parentui = parentui.parentui or parentui 45 self.parentui = parentui.parentui or parentui
124 if name is None or name == 'interactive': 124 if name is None or name == 'interactive':
125 self.interactive = self.configbool("ui", "interactive", True) 125 self.interactive = self.configbool("ui", "interactive", True)
126 126
127 def setconfig(self, section, name, value): 127 def setconfig(self, section, name, value):
128 if not self.overlay: 128 if not self.overlay:
129 self.overlay = ConfigParser.SafeConfigParser() 129 self.overlay = util.configparser()
130 for cdata in (self.overlay, self.cdata): 130 for cdata in (self.overlay, self.cdata):
131 if not cdata.has_section(section): 131 if not cdata.has_section(section):
132 cdata.add_section(section) 132 cdata.add_section(section)
133 cdata.set(section, name, value) 133 cdata.set(section, name, value)
134 self.fixconfig(section, name, value) 134 self.fixconfig(section, name, value)