comparison python/setup_repo.py @ 460:3cd5996c1329

python/setup_repo.py
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 10 Aug 2013 18:13:14 -0700
parents 32667483d1c5
children fba923298346
comparison
equal deleted inserted replaced
459:32667483d1c5 460:3cd5996c1329
32 command_str = command 32 command_str = command
33 else: 33 else:
34 command_str = ' '.join(command) 34 command_str = ' '.join(command)
35 print 'Running:\n%s' % (command_str) 35 print 'Running:\n%s' % (command_str)
36 if globals()['dry_run']: 36 if globals()['dry_run']:
37 import pdb; pdb.set_trace()
37 return 38 return
38 return subprocess.check_output(*args, **kwargs) 39 return subprocess.check_output(*args, **kwargs)
39 40
40 def init_repo(directory): 41 def init_repo(directory):
41 """setup repository""" 42 """setup repository"""
91 remote_path = path 92 remote_path = path
92 93
93 # setup remote repository 94 # setup remote repository
94 remote_dir = '~/%s/%s' % (path.lstrip('/'), name) 95 remote_dir = '~/%s/%s' % (path.lstrip('/'), name)
95 command = ['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)] 96 command = ['ssh', host, "mkdir -p %s && cd %s && hg init" % (remote_dir, remote_dir)]
96 print command 97 call(command)
97 # call(command)
98 98
99 99
100 def main(args=sys.argv[1:]): 100 def main(args=sys.argv[1:]):
101 101
102 # parse command line arguments 102 # parse command line arguments
139 # setup remote repository 139 # setup remote repository
140 setup_remote(directory, options.remote_url, name=name, remote_path=options.remote_path) 140 setup_remote(directory, options.remote_url, name=name, remote_path=options.remote_path)
141 141
142 # push changes 142 # push changes
143 command = ['hg', 'push', '-R', directory] 143 command = ['hg', 'push', '-R', directory]
144 print command 144 call(command)
145 # call(command)
146 145
147 if __name__ == '__main__': 146 if __name__ == '__main__':
148 main() 147 main()