Show More
@@ -97,42 +97,46 b' class ui(object):' | |||||
97 | root = os.path.expanduser('~') |
|
97 | root = os.path.expanduser('~') | |
98 | self.fixconfig(root=root) |
|
98 | self.fixconfig(root=root) | |
99 |
|
99 | |||
100 | def fixconfig(self, root=None): |
|
100 | def fixconfig(self, root=None, section=None): | |
101 | # expand vars and ~ |
|
101 | if section in (None, 'paths'): | |
102 | # translate paths relative to root (or home) into absolute paths |
|
102 | # expand vars and ~ | |
103 | root = root or os.getcwd() |
|
103 | # translate paths relative to root (or home) into absolute paths | |
104 | for c in self._tcfg, self._ucfg, self._ocfg: |
|
104 | root = root or os.getcwd() | |
105 | for n, p in c.items('paths'): |
|
105 | for c in self._tcfg, self._ucfg, self._ocfg: | |
106 |
|
|
106 | for n, p in c.items('paths'): | |
107 |
|
|
107 | if not p: | |
108 |
|
|
108 | continue | |
109 | self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") |
|
109 | if '%%' in p: | |
110 | % (n, p, self.configsource('paths', n))) |
|
110 | self.warn(_("(deprecated '%%' in path %s=%s from %s)\n") | |
111 | p = p.replace('%%', '%') |
|
111 | % (n, p, self.configsource('paths', n))) | |
112 | p = util.expandpath(p) |
|
112 | p = p.replace('%%', '%') | |
113 |
|
|
113 | p = util.expandpath(p) | |
114 | p = os.path.normpath(os.path.join(root, p)) |
|
114 | if '://' not in p and not os.path.isabs(p): | |
115 | c.set("paths", n, p) |
|
115 | p = os.path.normpath(os.path.join(root, p)) | |
|
116 | c.set("paths", n, p) | |||
116 |
|
117 | |||
117 | # update ui options |
|
118 | if section in (None, 'ui'): | |
118 | self.debugflag = self.configbool('ui', 'debug') |
|
119 | # update ui options | |
119 |
|
|
120 | self.debugflag = self.configbool('ui', 'debug') | |
120 |
self. |
|
121 | self.verbose = self.debugflag or self.configbool('ui', 'verbose') | |
121 | if self.verbose and self.quiet: |
|
122 | self.quiet = not self.debugflag and self.configbool('ui', 'quiet') | |
122 |
|
|
123 | if self.verbose and self.quiet: | |
123 | self._reportuntrusted = self.configbool("ui", "report_untrusted", True) |
|
124 | self.quiet = self.verbose = False | |
124 | self.tracebackflag = self.configbool('ui', 'traceback', False) |
|
125 | self._reportuntrusted = self.configbool("ui", "report_untrusted", | |
|
126 | True) | |||
|
127 | self.tracebackflag = self.configbool('ui', 'traceback', False) | |||
125 |
|
128 | |||
126 | # update trust information |
|
129 | if section in (None, 'trusted'): | |
127 | self._trustusers.update(self.configlist('trusted', 'users')) |
|
130 | # update trust information | |
128 |
self._trust |
|
131 | self._trustusers.update(self.configlist('trusted', 'users')) | |
|
132 | self._trustgroups.update(self.configlist('trusted', 'groups')) | |||
129 |
|
133 | |||
130 | def setconfig(self, section, name, value, overlay=True): |
|
134 | def setconfig(self, section, name, value, overlay=True): | |
131 | if overlay: |
|
135 | if overlay: | |
132 | self._ocfg.set(section, name, value) |
|
136 | self._ocfg.set(section, name, value) | |
133 | self._tcfg.set(section, name, value) |
|
137 | self._tcfg.set(section, name, value) | |
134 | self._ucfg.set(section, name, value) |
|
138 | self._ucfg.set(section, name, value) | |
135 | self.fixconfig() |
|
139 | self.fixconfig(section=section) | |
136 |
|
140 | |||
137 | def _data(self, untrusted): |
|
141 | def _data(self, untrusted): | |
138 | return untrusted and self._ucfg or self._tcfg |
|
142 | return untrusted and self._ucfg or self._tcfg |
General Comments 0
You need to be logged in to leave comments.
Login now