##// END OF EJS Templates
make readconfig take a filename instead of a file pointer as argument...
Benoit Boissinot -
r1473:7d66ce98 default
parent child Browse files
Show More
@@ -0,0 +1,7 b''
1 #!/bin/sh
2
3 mkdir t
4 cd t
5 hg init
6 echo "invalid" > .hg/hgrc
7 hg status 2>&1 |sed -e "s:/.*\(/t/.*\):...\1:"
@@ -990,7 +990,7 b' class hgwebdir:'
990 for name, path in self.repos:
990 for name, path in self.repos:
991 u = ui.ui()
991 u = ui.ui()
992 try:
992 try:
993 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
993 u.readconfig(os.path.join(path, '.hg', 'hgrc'))
994 except IOError:
994 except IOError:
995 pass
995 pass
996 get = u.config
996 get = u.config
@@ -43,7 +43,7 b' class localrepository:'
43
43
44 self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
44 self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
45 try:
45 try:
46 self.ui.readconfig(self.opener("hgrc"))
46 self.ui.readconfig(os.path.join(self.path, "hgrc"))
47 except IOError: pass
47 except IOError: pass
48
48
49 def hook(self, name, **args):
49 def hook(self, name, **args):
@@ -15,7 +15,7 b' class ui:'
15 interactive=True):
15 interactive=True):
16 self.overlay = {}
16 self.overlay = {}
17 self.cdata = ConfigParser.SafeConfigParser()
17 self.cdata = ConfigParser.SafeConfigParser()
18 self.cdata.read(util.rcpath)
18 self.readconfig(util.rcpath)
19
19
20 self.quiet = self.configbool("ui", "quiet")
20 self.quiet = self.configbool("ui", "quiet")
21 self.verbose = self.configbool("ui", "verbose")
21 self.verbose = self.configbool("ui", "verbose")
@@ -31,8 +31,11 b' class ui:'
31 self.debugflag = (self.debugflag or debug)
31 self.debugflag = (self.debugflag or debug)
32 self.interactive = (self.interactive and interactive)
32 self.interactive = (self.interactive and interactive)
33
33
34 def readconfig(self, fp):
34 def readconfig(self, fn):
35 self.cdata.readfp(fp)
35 try:
36 self.cdata.read(fn)
37 except ConfigParser.ParsingError, inst:
38 raise util.Abort(_("Failed to parse %s\n%s") % (fn, inst))
36
39
37 def setconfig(self, section, name, val):
40 def setconfig(self, section, name, val):
38 self.overlay[(section, name)] = val
41 self.overlay[(section, name)] = val
General Comments 0
You need to be logged in to leave comments. Login now