Mercurial > code > home > repos > reposync
diff repo_local_status.py @ 21:cb71722bb75c
use pipenv
author | drewp@bigasterisk.com |
---|---|
date | Tue, 29 Mar 2022 21:13:48 -0700 |
parents | b59912649fc4 |
children | b9fe6d26b3fa |
line wrap: on
line diff
--- a/repo_local_status.py Sun Jan 09 20:47:57 2022 -0800 +++ b/repo_local_status.py Tue Mar 29 21:13:48 2022 -0700 @@ -41,12 +41,19 @@ HG_SYNC = Gauge('hg_sync', 'sync passes to hg') +_venv = None + @inlineCallbacks def runHg(cwd, args): + global _venv + if _venv is None: + _venv = yield getProcessOutput('pipenv', ['--venv']) + _venv = _venv.decode('ascii').strip() + if args[0] not in ['push']: args.extend(['-T', 'json']) - j = yield getProcessOutput('/usr/local/bin/hg', args, path=cwd) + j = yield getProcessOutput(_venv + '/bin/hg', ['--cwd', str(cwd)] + args, env={'LANG': 'C.UTF-8'}) returnValue(json.loads(j) if j else None) @@ -112,9 +119,11 @@ def uriForHgNode(n: str) -> URIRef: return URIRef(f'http://bigasterisk.com/hg/node/{n}') + def uriForHgPhase(phase: str) -> URIRef: return URIRef(f'http://bigasterisk.com/hg/phase/{phase}') + @inlineCallbacks def writeLatestHgCommit(graph, repo): rows = yield runHg(repo.path, ['log', '--limit', '1'])