changeset 350:52e718567731

minor improvements
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 27 Jun 2013 00:04:12 -0700
parents 8161806daa20
children 971e7deca495
files python/hgrc.py
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 <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__':