# HG changeset patch # User Jeff Hammel # Date 1372316652 25200 # Node ID 52e718567731932bfe11b7fdba3c6ba36bdead3f # Parent 8161806daa2055c0cf2443a517306d2a69fa575c minor improvements diff -r 8161806daa20 -r 52e718567731 python/hgrc.py --- a/python/hgrc.py Wed Jun 26 20:12:32 2013 -0700 +++ b/python/hgrc.py Thu Jun 27 00:04:12 2013 -0700 @@ -1,8 +1,11 @@ #!/usr/bin/env python -''' +""" +Script for modifying hgrc files. -''' +Actions: +(TBD) +""" import optparse import os @@ -12,11 +15,15 @@ def main(args=sys.argv[1:]): + # command line parser usage = '%prog [options] repository <...>' parser = optparse.OptionParser(usage=usage, description=__doc__) + parser.add_option('-p', '--print', dest='print', + action='store_true', default=False, + help="print full path to hgrc files and exit") parser.add_option('--ssh', dest='default_push_ssh', action='store_true', default=False, - help="") + help="use `default` entries for `default-push`") options, args = options.parse_args(args) if not args: parser.print_usage() @@ -24,12 +31,13 @@ # find all .hgrc files hgrc = [] - - # all the error types missing = [] not_hg = [] not_a_directory = [] - + errors = {'Missing path': missing, + 'Not a mercurial directory': not_hg, + 'Not a directory': not_a_directory, + } for path in args: if not os.path.exists(path): missing.append(path) @@ -46,7 +54,8 @@ else: not_hg.append(path) continue - + else: + assert os.path.isfile(path), "%s is not a file, exiting" % path if __name__ == '__main__':