Mercurial > dotfiles
comparison unixSoft/bin/havepatch @ 436:97f12f43f73b
havepatch: always import hg libs from the hg we're using
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sun, 18 Jun 2017 22:45:40 -0400 |
parents | d81eb79e4f4c |
children |
comparison
equal
deleted
inserted
replaced
435:d81eb79e4f4c | 436:97f12f43f73b |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 """Detect if a patch is already applied in a Mercurial repository.""" | 2 """Detect if a patch is already applied in a Mercurial repository.""" |
3 import json | |
3 import os | 4 import os |
4 import re | 5 import re |
5 import subprocess | 6 import subprocess |
6 import sys | 7 import sys |
8 | |
9 # Always load hg libraries from the hg we can find on $PATH. | |
10 hglib = json.loads(subprocess.check_output( | |
11 ['hg', 'debuginstall', '-Tjson']))[0]['hgmodules'] | |
12 sys.path.insert(0, os.path.dirname(hglib)) | |
7 | 13 |
8 from mercurial import util | 14 from mercurial import util |
9 | 15 |
10 def main(argv): | 16 def main(argv): |
11 os.chdir(util.expandpath('~/Programming/hg/crew')) | 17 os.chdir(util.expandpath('~/Programming/hg/crew')) |