Show More
@@ -5,11 +5,22 prefixed with "no-", the absence of feat | |||
|
5 | 5 | """ |
|
6 | 6 | import optparse |
|
7 | 7 | import os |
|
8 | import re | |
|
8 | 9 | import sys |
|
9 | 10 | import tempfile |
|
10 | 11 | |
|
11 | 12 | tempprefix = 'hg-hghave-' |
|
12 | 13 | |
|
14 | def matchoutput(cmd, regexp): | |
|
15 | """Return True if cmd executes successfully and its output | |
|
16 | is matched by the supplied regular expression. | |
|
17 | """ | |
|
18 | r = re.compile(regexp) | |
|
19 | fh = os.popen(cmd) | |
|
20 | s = fh.read() | |
|
21 | ret = fh.close() | |
|
22 | return ret is None and r.search(s) | |
|
23 | ||
|
13 | 24 | def has_symlink(): |
|
14 | 25 | return hasattr(os, "symlink") |
|
15 | 26 | |
@@ -52,10 +63,7 def has_lsprof(): | |||
|
52 | 63 | return False |
|
53 | 64 | |
|
54 | 65 | def has_git(): |
|
55 | fh = os.popen('git --version 2>&1') | |
|
56 | s = fh.read() | |
|
57 | ret = fh.close() | |
|
58 | return ret is None and s.startswith('git version') | |
|
66 | return matchoutput('git --version 2>&1', r'^git version') | |
|
59 | 67 | |
|
60 | 68 | checks = { |
|
61 | 69 | "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
General Comments 0
You need to be logged in to leave comments.
Login now