Excerpts from David Soria Parra's message of 2017-03-29 15:56:21 -0700: > > + # immutable configs > > + self._ocfgs = config.mergedconfig('setconfig', []) # overlay > > + self._tcfgs = config.mergedconfig('loaded', []) # trusted > i would probably actually call them 'trusted' instead of 'loaded' > > + self._ucfgs = config.mergedconfig('loaded', []) # > > trusted+untrusted > with merge configs in, we would split up trusted+untrusted into trusted and > untrusted? > > > + def setconfig(self, section, name, value, source='', priority=None): > I think we can do better by using the title, e.g. 'untrusted', 'setconfig' to > access the right layer. a numeric priority seems to be very hard to use and I > think we could improve this interface a bit.
Yeah, the "priority" is added in the last hour. It was "overlay=True/False", until I met "ui.commitsubrepos", which seems to have to be a global affecting multiple uis. Basically we need at least 3 priorities: ('normal', 'overlay', 'global'). > > + title = source or 'setconfig' > > + acfg = config.atomicconfig(title, [(section, name, (value, > > source))]) > > + try: > > + cwd = pycompat.getcwd() > > + except OSError: > > + pass > > + else: > > + acfg = _fixpathsection(acfg, cwd) > > + if priority == 3: > > + # global overlay > > + self.__class__._gcfgs = self.__class__._gcfgs.append(acfg) > > + elif priority == 2: > > + # change overlay in this ui > > + self._ocfgs = self._ocfgs.append(acfg) > > + elif priority == 1: > > + # change overlay in this ui, do not override existing overlays > > + self._ocfgs = self._ocfgs.prepend(acfg) > > + else: > > + self._tcfgs = self._tcfgs.append(acfg) > > + self._ucfgs = self._ucfgs.append(acfg) > > _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel