# HG changeset patch # User Jeff Hammel # Date 1375205747 25200 # Node ID fb304dcd1e64195e02b0bf80bfb99d99d5075c4d # Parent 62eb670a408fbea4fcda214a4d9bb54dc6eef227 factor to its own method diff -r 62eb670a408f -r fb304dcd1e64 python/setup_repo.py --- a/python/setup_repo.py Tue Jul 30 03:42:15 2013 -0700 +++ b/python/setup_repo.py Tue Jul 30 10:35:47 2013 -0700 @@ -25,6 +25,13 @@ call = subprocess.check_output +def init_repo(directory): + """setup repository""" + call(['hg', 'init', directory]) + call(['hg', 'add', '-R', directory]) + call(['hg', 'commit', '-m', options.message, '-R', directory]) + + def main(args=sys.argv[1:]): # parse command line arguments @@ -42,16 +49,13 @@ if len(args) != 1: parser.print_usage() parser.exit() - # TODO: sanity check for remote_url, remote_path + directory = args[0] - # setup repository - directory = args[0] - name = os.path.basename(directory) # XXX unnecessary? - call(['hg', 'init', directory]) - call(['hg', 'add', '-R', directory]) - call(['hg', 'commit', '-m', options.message, '-R', directory]) + # initialize repository + init_repo(directory) # setup remote, if specified + name = os.path.basename(directory) if options.remote_url: # parse remote URL