comparison python/hgrc.py @ 467:980584d34134

python/hgrc.py
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 10 Aug 2013 18:50:44 -0700
parents 3ffcbffb6fb4
children 4853551536d6
comparison
equal deleted inserted replaced
466:3ffcbffb6fb4 467:980584d34134
11 import os 11 import os
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 from ConfigParser import RawConfigParser as ConfigParser 14 from ConfigParser import RawConfigParser as ConfigParser
15 15
16 def set_default_push(parser, default_push):
17 """
18 set [paths]:default_push to `default_push`
19 """
20 pass
21
22 def set_default_push_to_ssh():
23 pass
24
16 def main(args=sys.argv[1:]): 25 def main(args=sys.argv[1:]):
17 26
18 # parse command line arguments 27 # parse command line arguments
19 usage = '%prog [options] repository <repository> <...>' 28 usage = '%prog [options] repository <repository> <...>'
20 parser = optparse.OptionParser(usage=usage, description=__doc__) 29 parser = optparse.OptionParser(usage=usage, description=__doc__)
25 action='store_true', default=False, 34 action='store_true', default=False,
26 help="use `default` entries for `default-push`") 35 help="use `default` entries for `default-push`")
27 parser.add_option('--push', '--default-push', dest='default_push', 36 parser.add_option('--push', '--default-push', dest='default_push',
28 help="set [paths] default-push location") 37 help="set [paths] default-push location")
29 options, args = parser.parse_args(args) 38 options, args = parser.parse_args(args)
39
40 # sanitization
41 if options.default_push and options.default_push_ssh:
42 parser.error("Cannot set --push and --ssh")
30 43
31 # if not specified, use repo from `hg root` 44 # if not specified, use repo from `hg root`
32 if not args: 45 if not args:
33 args = [subprocess.check_output(['hg', 'root']).strip()] 46 args = [subprocess.check_output(['hg', 'root']).strip()]
34 47