# HG changeset patch # User Augie Fackler # Date 1497840340 14400 # Node ID 97f12f43f73b793f8d27696a4fb8134f12e05e99 # Parent d81eb79e4f4cef7ab2d214fc21d3f1dccf18a6a2 havepatch: always import hg libs from the hg we're using diff --git a/unixSoft/bin/havepatch b/unixSoft/bin/havepatch --- a/unixSoft/bin/havepatch +++ b/unixSoft/bin/havepatch @@ -1,10 +1,16 @@ #!/usr/bin/env python """Detect if a patch is already applied in a Mercurial repository.""" +import json import os import re import subprocess import sys +# Always load hg libraries from the hg we can find on $PATH. +hglib = json.loads(subprocess.check_output( + ['hg', 'debuginstall', '-Tjson']))[0]['hgmodules'] +sys.path.insert(0, os.path.dirname(hglib)) + from mercurial import util def main(argv):