コード例 #1
0
    def fixconfig(self, root=None, section=None):
        if section in (None, 'paths'):
            # expand vars and ~
            # translate paths relative to root (or home) into absolute paths
            root = root or os.getcwd()
            for c in self._tcfg, self._ucfg, self._ocfg:
                for n, p in c.items('paths'):
                    if not p:
                        continue
                    if '%%' in p:
                        self.warn(
                            _("(deprecated '%%' in path %s=%s from %s)\n") %
                            (n, p, self.configsource('paths', n)))
                        p = p.replace('%%', '%')
                    p = util.expandpath(p)
                    if not util.hasscheme(p) and not os.path.isabs(p):
                        p = os.path.normpath(os.path.join(root, p))
                    c.set("paths", n, p)

        if section in (None, 'ui'):
            # update ui options
            self.debugflag = self.configbool('ui', 'debug')
            self.verbose = self.debugflag or self.configbool('ui', 'verbose')
            self.quiet = not self.debugflag and self.configbool('ui', 'quiet')
            if self.verbose and self.quiet:
                self.quiet = self.verbose = False
            self._reportuntrusted = self.debugflag or self.configbool(
                "ui", "report_untrusted", True)
            self.tracebackflag = self.configbool('ui', 'traceback', False)

        if section in (None, 'trusted'):
            # update trust information
            self._trustusers.update(self.configlist('trusted', 'users'))
            self._trustgroups.update(self.configlist('trusted', 'groups'))
コード例 #2
0
ファイル: ui.py プロジェクト: agbiotec/galaxy-tools-vcr
    def fixconfig(self, root=None, section=None):
        if section in (None, 'paths'):
            # expand vars and ~
            # translate paths relative to root (or home) into absolute paths
            root = root or os.getcwd()
            for c in self._tcfg, self._ucfg, self._ocfg:
                for n, p in c.items('paths'):
                    if not p:
                        continue
                    if '%%' in p:
                        self.warn(_("(deprecated '%%' in path %s=%s from %s)\n")
                                  % (n, p, self.configsource('paths', n)))
                        p = p.replace('%%', '%')
                    p = util.expandpath(p)
                    if not util.hasscheme(p) and not os.path.isabs(p):
                        p = os.path.normpath(os.path.join(root, p))
                    c.set("paths", n, p)

        if section in (None, 'ui'):
            # update ui options
            self.debugflag = self.configbool('ui', 'debug')
            self.verbose = self.debugflag or self.configbool('ui', 'verbose')
            self.quiet = not self.debugflag and self.configbool('ui', 'quiet')
            if self.verbose and self.quiet:
                self.quiet = self.verbose = False
            self._reportuntrusted = self.debugflag or self.configbool("ui",
                "report_untrusted", True)
            self.tracebackflag = self.configbool('ui', 'traceback', False)

        if section in (None, 'trusted'):
            # update trust information
            self._trustusers.update(self.configlist('trusted', 'users'))
            self._trustgroups.update(self.configlist('trusted', 'groups'))
コード例 #3
0
    def expandpath(self, loc, default=None):
        """Return repository location relative to cwd or from [paths]"""
        if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
            return loc

        path = self.config('paths', loc)
        if not path and default is not None:
            path = self.config('paths', default)
        return path or loc
コード例 #4
0
ファイル: ui.py プロジェクト: agbiotec/galaxy-tools-vcr
    def expandpath(self, loc, default=None):
        """Return repository location relative to cwd or from [paths]"""
        if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
            return loc

        path = self.config('paths', loc)
        if not path and default is not None:
            path = self.config('paths', default)
        return path or loc
コード例 #5
0
ファイル: ui.py プロジェクト: RayFerr000/PLTL
    def expandpath(self, loc, default=None):
        """Return repository location relative to cwd or from [paths]"""
        if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
            return loc

        p = self.paths.getpath(loc, default=default)
        if p:
            return p.loc
        return loc
コード例 #6
0
ファイル: ui.py プロジェクト: pierfort123/mercurial
    def expandpath(self, loc, default=None):
        """Return repository location relative to cwd or from [paths]"""
        if util.hasscheme(loc) or os.path.isdir(os.path.join(loc, '.hg')):
            return loc

        p = self.paths.getpath(loc, default=default)
        if p:
            return p.loc
        return loc