comparison python/setup_repo.py @ 526:4063bbeaa7d4

initial commit
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 24 Sep 2013 13:10:58 -0700
parents 35f3730870e7
children 76b1723c87fc
comparison
equal deleted inserted replaced
525:37f8bc525888 526:4063bbeaa7d4
36 print 'Running:\n%s' % (command_str) 36 print 'Running:\n%s' % (command_str)
37 if globals()['dry_run']: 37 if globals()['dry_run']:
38 return 38 return
39 return subprocess.check_output(*args, **kwargs) 39 return subprocess.check_output(*args, **kwargs)
40 40
41 def init_repo(directory): 41 def init_repo(directory, message):
42 """setup repository""" 42 """setup repository"""
43 call(['hg', 'init', directory]) 43 call(['hg', 'init', directory])
44 call(['hg', 'add', '-R', directory]) 44 call(['hg', 'add', '-R', directory])
45 call(['hg', 'commit', '-m', options.message, '-R', directory]) 45 call(['hg', 'commit', '-m', message, '-R', directory])
46 46
47 def write_hgrc(directory, host, repo, name): 47 def write_hgrc(directory, host, repo, name):
48 """write hgrc file""" 48 """write hgrc file"""
49 49
50 HGRC="""[paths] 50 HGRC="""[paths]
128 128
129 # initialize repository 129 # initialize repository
130 if options.remote_only: 130 if options.remote_only:
131 assert options.remote_url 131 assert options.remote_url
132 else: 132 else:
133 init_repo(directory) 133 init_repo(directory, options.message)
134 134
135 # setup remote, if specified 135 # setup remote, if specified
136 name = os.path.basename(directory) 136 name = os.path.basename(directory)
137 if options.remote_url: 137 if options.remote_url:
138 138