Mercurial > hg-stable
changeset 8190:9b8ac5fb7760
ui: kill most users of parentui name and arg, replace with .copy()
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:43 -0500 |
parents | d2899a856f9f |
children | 35604226d712 |
files | hgext/zeroconf/__init__.py mercurial/commands.py mercurial/dispatch.py mercurial/hgweb/hgwebdir_mod.py mercurial/ui.py tests/test-trusted.py |
diffstat | 6 files changed, 18 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/zeroconf/__init__.py Sun Apr 26 16:50:43 2009 -0500 +++ b/hgext/zeroconf/__init__.py Sun Apr 26 16:50:43 2009 -0500 @@ -112,7 +112,7 @@ class hgwebdirzc(hgwebdir_mod.hgwebdir): def run(self): for r, p in self.repos: - u = ui.ui(parentui=self.parentui) + u = self.parentui.copy() u.readconfig(os.path.join(p, '.hg', 'hgrc')) n = os.path.basename(r) publish(n, "hgweb", p, int(u.config("web", "port", 8000)))
--- a/mercurial/commands.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/commands.py Sun Apr 26 16:50:43 2009 -0500 @@ -2677,13 +2677,13 @@ s = sshserver.sshserver(ui, repo) s.serve_forever() - parentui = repo and repo.baseui or ui + baseui = repo and repo.baseui or ui optlist = ("name templates style address port prefix ipv6" " accesslog errorlog webdir_conf certificate") for o in optlist.split(): if opts[o]: - parentui.setconfig("web", o, str(opts[o])) - if (repo is not None) and (repo.ui != parentui): + baseui.setconfig("web", o, str(opts[o])) + if (repo is not None) and (repo.ui != baseui): repo.ui.setconfig("web", o, str(opts[o])) if repo is None and not ui.config("web", "webdir_conf"): @@ -2693,7 +2693,7 @@ class service: def init(self): util.set_signal_handler() - self.httpd = hgweb.server.create_server(parentui, repo) + self.httpd = hgweb.server.create_server(baseui, repo) if not ui.verbose: return
--- a/mercurial/dispatch.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/dispatch.py Sun Apr 26 16:50:43 2009 -0500 @@ -269,7 +269,7 @@ lui = ui if path: try: - lui = _ui.ui(parentui=ui) + lui = ui.copy() lui.readconfig(os.path.join(path, ".hg", "hgrc")) except IOError: pass @@ -278,7 +278,7 @@ rpath = _earlygetopt(["-R", "--repository", "--repo"], args) if rpath: path = lui.expandpath(rpath[-1]) - lui = _ui.ui(parentui=ui) + lui = ui.copy() lui.readconfig(os.path.join(path, ".hg", "hgrc")) extensions.loadall(lui)
--- a/mercurial/hgweb/hgwebdir_mod.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/hgweb/hgwebdir_mod.py Sun Apr 26 16:50:43 2009 -0500 @@ -203,7 +203,7 @@ continue name = name[len(subdir):] - u = ui.ui(parentui=self.parentui) + u = self.parentui.copy() try: u.readconfig(os.path.join(path, '.hg', 'hgrc')) except Exception, e:
--- a/mercurial/ui.py Sun Apr 26 16:50:43 2009 -0500 +++ b/mercurial/ui.py Sun Apr 26 16:50:43 2009 -0500 @@ -13,7 +13,7 @@ '0':False, 'no':False, 'false':False, 'off':False} class ui(object): - def __init__(self, parentui=None): + def __init__(self, src=None): self.buffers = [] self.quiet = self.verbose = self.debugflag = self.traceback = False self.interactive = self.report_untrusted = True @@ -23,12 +23,12 @@ self.trusted_users = {} self.trusted_groups = {} - if parentui: - self.cdata = parentui.cdata.copy() - self.ucdata = parentui.ucdata.copy() - self.overlay = parentui.overlay.copy() - self.trusted_users = parentui.trusted_users.copy() - self.trusted_groups = parentui.trusted_groups.copy() + if src: + self.cdata = src.cdata.copy() + self.ucdata = src.ucdata.copy() + self.overlay = src.overlay.copy() + self.trusted_users = src.trusted_users.copy() + self.trusted_groups = src.trusted_groups.copy() self.fixconfig() else: # we always trust global config files
--- a/tests/test-trusted.py Sun Apr 26 16:50:43 2009 -0500 +++ b/tests/test-trusted.py Sun Apr 26 16:50:43 2009 -0500 @@ -59,9 +59,8 @@ print '# %s user, %s group%s' % (kind[user == cuser], kind[group == cgroup], trusted) - parentui = ui.ui() - parentui.setconfig('ui', 'debug', str(bool(debug))) - u = ui.ui(parentui=parentui) + u = ui.ui() + u.setconfig('ui', 'debug', str(bool(debug))) u.readconfig('.hg/hgrc') if silent: return u @@ -146,7 +145,7 @@ u = ui.ui() u.setconfig('ui', 'debug', 'on') u.readconfig(filename) -u2 = ui.ui(parentui=u) +u2 = u.copy() def username(uid=None): return 'foo' util.username = username