Mercurial > hg > config
comparison python/hgrc.py @ 348:6004e00b602d
new hg file; TODO: incorporate!
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 26 Jun 2013 17:39:15 -0700 |
parents | |
children | 52e718567731 |
comparison
equal
deleted
inserted
replaced
347:c0f0f82f68ea | 348:6004e00b602d |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 ''' | |
4 | |
5 ''' | |
6 | |
7 import optparse | |
8 import os | |
9 import sys | |
10 | |
11 here = os.path.dirname(os.path.realpath(__file__)) | |
12 | |
13 def main(args=sys.argv[1:]): | |
14 | |
15 usage = '%prog [options] repository <repository> <...>' | |
16 parser = optparse.OptionParser(usage=usage, description=__doc__) | |
17 parser.add_option('--ssh', dest='default_push_ssh', | |
18 action='store_true', default=False, | |
19 help="") | |
20 options, args = options.parse_args(args) | |
21 if not args: | |
22 parser.print_usage() | |
23 parser.exit() | |
24 | |
25 # find all .hgrc files | |
26 hgrc = [] | |
27 | |
28 # all the error types | |
29 missing = [] | |
30 not_hg = [] | |
31 not_a_directory = [] | |
32 | |
33 for path in args: | |
34 if not os.path.exists(path): | |
35 missing.append(path) | |
36 path = os.path.abspath(os.path.normpath(path)) | |
37 if os.path.isdir(path): | |
38 basename = os.path.basename(path) | |
39 subhgdir = os.path.join(path, '.hg') # hypothetical .hg subdirectory | |
40 if basename == '.hg': | |
41 hgrcpath = os.path.join(path, 'hgrc') | |
42 elif os.path.exists(subhgdir): | |
43 if not os.path.isdir(subhgdir): | |
44 not_a_directory.append(subhgdir) | |
45 continue | |
46 else: | |
47 not_hg.append(path) | |
48 continue | |
49 | |
50 | |
51 | |
52 if __name__ == '__main__': | |
53 main() |