Show More
@@ -17,16 +17,16 b' class ui(object):' | |||
|
17 | 17 | self._buffers = [] |
|
18 | 18 | self.quiet = self.verbose = self.debugflag = self.traceback = False |
|
19 | 19 | self.interactive = self.report_untrusted = True |
|
20 |
self. |
|
|
21 |
self. |
|
|
22 |
self. |
|
|
20 | self._ocfg = config.config() # overlay | |
|
21 | self._tcfg = config.config() # trusted | |
|
22 | self._ucfg = config.config() # untrusted | |
|
23 | 23 | self._trustusers = {} |
|
24 | 24 | self._trustgroups = {} |
|
25 | 25 | |
|
26 | 26 | if src: |
|
27 |
self. |
|
|
28 |
self. |
|
|
29 |
self. |
|
|
27 | self._tcfg = src._tcfg.copy() | |
|
28 | self._ucfg = src._ucfg.copy() | |
|
29 | self._ocfg = src._ocfg.copy() | |
|
30 | 30 | self._trustusers = src._trustusers.copy() |
|
31 | 31 | self._trustgroups = src._trustgroups.copy() |
|
32 | 32 | self.fixconfig() |
@@ -77,21 +77,21 b' class ui(object):' | |||
|
77 | 77 | return |
|
78 | 78 | raise |
|
79 | 79 | |
|
80 |
c |
|
|
80 | cfg = config.config() | |
|
81 | 81 | trusted = sections or trust or self._is_trusted(fp, filename) |
|
82 | 82 | |
|
83 | 83 | try: |
|
84 |
c |
|
|
84 | cfg.read(filename, fp, sections=sections) | |
|
85 | 85 | except error.ConfigError, inst: |
|
86 | 86 | if trusted: |
|
87 | 87 | raise |
|
88 | 88 | self.warn(_("Ignored: %s\n") % str(inst)) |
|
89 | 89 | |
|
90 | 90 | if trusted: |
|
91 |
self. |
|
|
92 |
self. |
|
|
93 |
self. |
|
|
94 |
self. |
|
|
91 | self._tcfg.update(cfg) | |
|
92 | self._tcfg.update(self._ocfg) | |
|
93 | self._ucfg.update(cfg) | |
|
94 | self._ucfg.update(self._ocfg) | |
|
95 | 95 | |
|
96 | 96 | if root is None: |
|
97 | 97 | root = os.path.expanduser('~') |
@@ -100,7 +100,7 b' class ui(object):' | |||
|
100 | 100 | def fixconfig(self, root=None): |
|
101 | 101 | # translate paths relative to root (or home) into absolute paths |
|
102 | 102 | root = root or os.getcwd() |
|
103 |
for c in self. |
|
|
103 | for c in self._tcfg, self._ucfg, self._ocfg: | |
|
104 | 104 | for n, p in c.items('paths'): |
|
105 | 105 | if p and "://" not in p and not os.path.isabs(p): |
|
106 | 106 | c.set("paths", n, os.path.normpath(os.path.join(root, p))) |
@@ -122,12 +122,12 b' class ui(object):' | |||
|
122 | 122 | self._trustgroups[group] = 1 |
|
123 | 123 | |
|
124 | 124 | def setconfig(self, section, name, value): |
|
125 |
for c |
|
|
126 |
c |
|
|
125 | for cfg in (self._ocfg, self._tcfg, self._ucfg): | |
|
126 | cfg.set(section, name, value) | |
|
127 | 127 | self.fixconfig() |
|
128 | 128 | |
|
129 | 129 | def _data(self, untrusted): |
|
130 |
return untrusted and self. |
|
|
130 | return untrusted and self._ucfg or self._tcfg | |
|
131 | 131 | |
|
132 | 132 | def configsource(self, section, name, untrusted=False): |
|
133 | 133 | return self._data(untrusted).source(section, name) or 'none' |
@@ -135,7 +135,7 b' class ui(object):' | |||
|
135 | 135 | def config(self, section, name, default=None, untrusted=False): |
|
136 | 136 | value = self._data(untrusted).get(section, name, default) |
|
137 | 137 | if self.debugflag and not untrusted: |
|
138 |
uvalue = self. |
|
|
138 | uvalue = self._ucfg.get(section, name) | |
|
139 | 139 | if uvalue is not None and uvalue != value: |
|
140 | 140 | self.warn(_("Ignoring untrusted configuration option " |
|
141 | 141 | "%s.%s = %s\n") % (section, name, uvalue)) |
@@ -166,15 +166,15 b' class ui(object):' | |||
|
166 | 166 | def configitems(self, section, untrusted=False): |
|
167 | 167 | items = self._data(untrusted).items(section) |
|
168 | 168 | if self.debugflag and not untrusted: |
|
169 |
for k,v in self. |
|
|
170 |
if self. |
|
|
169 | for k,v in self._ucfg.items(section): | |
|
170 | if self._tcfg.get(section, k) != v: | |
|
171 | 171 | self.warn(_("Ignoring untrusted configuration option " |
|
172 | 172 | "%s.%s = %s\n") % (section, k, v)) |
|
173 | 173 | return items |
|
174 | 174 | |
|
175 | 175 | def walkconfig(self, untrusted=False): |
|
176 |
c |
|
|
177 |
for section in c |
|
|
176 | cfg = self._data(untrusted) | |
|
177 | for section in cfg.sections(): | |
|
178 | 178 | for name, value in self.configitems(section, untrusted): |
|
179 | 179 | yield section, name, str(value).replace('\n', '\\n') |
|
180 | 180 |
General Comments 0
You need to be logged in to leave comments.
Login now