# Copyright 2008-2009 LShift Ltdimport sysimport os.pathimport mercurial.configglobalconfig = Nonedef _getConf(): global globalconfig if globalconfig is None: globalconfig = mercurial.config.config() globalconfig.read(os.path.expanduser("~/.mercurial-server")) return globalconfigdef configExists(): try: _getConf() return True except: return Falsedef _getPath(name): return os.path.expanduser(_getConf()["paths"][name])def _getPaths(name): return [os.path.expanduser(p) for p in _getConf()["paths"][name].split(":")]def getExePath(): return _getPath("exe")def getReposPath(): return _getPath("repos")def getKeysPaths(): return _getPaths("keys")def getAccessPaths(): return _getPaths("access")# This goes into an env var, so pass it on verbatim.def getHgrcPaths(): return _getConf()["paths"]["hgrc"]# Work out where we are, don't use config.def setExePath(): global _exePath _exePath = os.path.dirname(os.path.abspath(sys.argv[0]))def getExePath(): return _exePath