comparison python/setup_repo.py @ 447:daa9356d614f

python/setup_repo.py
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 09 Aug 2013 16:58:12 -0700
parents 38dd72d72086
children 056befdec66c
comparison
equal deleted inserted replaced
446:95afeaf9c42d 447:daa9356d614f
54 else: 54 else:
55 remote_path = path 55 remote_path = path
56 56
57 # setup remote repository 57 # setup remote repository
58 remote_dir = '%s/%s' % (path, name) 58 remote_dir = '%s/%s' % (path, name)
59 call(['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)]) 59 command = ['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)]
60 call(command)
60 61
61 62
62 def main(args=sys.argv[1:]): 63 def main(args=sys.argv[1:]):
63 64
64 # parse command line arguments 65 # parse command line arguments
73 help="remote path of hg repository links; otherwise taken from --remote-url, if specified") 74 help="remote path of hg repository links; otherwise taken from --remote-url, if specified")
74 parser.add_option('-o', '--remote-only', dest='remote_only', 75 parser.add_option('-o', '--remote-only', dest='remote_only',
75 action='store_true', default=False, 76 action='store_true', default=False,
76 help="setup remote server only") 77 help="setup remote server only")
77 options, args = parser.parse_args(args) 78 options, args = parser.parse_args(args)
78 if len(args) != 1:
79 parser.print_usage()
80 parser.exit()
81 directory = args[0]
82 79
83 # initialize repository 80 # initialize repository
84 if not options.remote_only: 81 if options.remote_only:
82 assert options.remote_url
83 else:
84 if len(args) != 1:
85 parser.print_usage()
86 parser.exit()
87 directory = args[0]
85 init_repo(directory) 88 init_repo(directory)
86 89
87 # setup remote, if specified 90 # setup remote, if specified
88 name = os.path.basename(directory) 91 name = os.path.basename(directory)
89 if options.remote_url: 92 if options.remote_url: