comparison mozillatry.py @ 6:6f35d0d90c64

move more to configuration land
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 04 Dec 2012 11:16:14 -0800
parents 416f4562005c
children 51d1167cc684
comparison
equal deleted inserted replaced
5:416f4562005c 6:6f35d0d90c64
61 message = ['try:'] 61 message = ['try:']
62 message += ['-b', '%s%s' % (('d' if debug else ''), ('o' if opt else ''))] 62 message += ['-b', '%s%s' % (('d' if debug else ''), ('o' if opt else ''))]
63 message += ['-u', (','.join(unittests) if unittests else 'none')] 63 message += ['-u', (','.join(unittests) if unittests else 'none')]
64 message += ['-t', (','.join(talos) if talos else 'none')] 64 message += ['-t', (','.join(talos) if talos else 'none')]
65 if bug: 65 if bug:
66 message += ['--post-to-bugzilla', str(bug)] 66 message += ['--post-to-bugzilla', 'Bug', str(bug)]
67 return ' '.join(message) 67 return ' '.join(message)
68 68
69 class MozillaTryConfiguration(configuration.Configuration): 69 class MozillaTryConfiguration(configuration.Configuration):
70 70
71 usage = '%prog [options] patch <patch2> <...>' 71 usage = '%prog [options] patch <patch2> <...>'
83 'required': True, 83 'required': True,
84 'flags': ["--m-c", "--mozilla-central"]} 84 'flags': ["--m-c", "--mozilla-central"]}
85 } 85 }
86 86
87 def __init__(self): 87 def __init__(self):
88 configuration.Configuration.__init__(usage=self.usage, load='--config') 88 configuration.Configuration.__init__(self, usage=self.usage, load='--config')
89 89
90 def check(self, parser, options, args): 90 def check(self, parser, options, args):
91 """check configuration""" 91 """check configuration"""
92 92
93 if not args: 93 if not args:
119 119
120 120
121 def main(args=sys.argv[1:]): 121 def main(args=sys.argv[1:]):
122 122
123 # parse command line arguments 123 # parse command line arguments
124 config = MozillaTryConfiguration() 124 parser = MozillaTryConfiguration()
125 options, args = parser.parse_args()
125 126
126 # get mozilla-central repository directory 127 # get mozilla-central repository directory
127 try_directory = options.mozilla_central 128 try_directory = options.mozilla_central
128 if (try_directory is None) or (not os.path.exists(try_directory)): 129 if (try_directory is None) or (not os.path.exists(try_directory)):
129 parser.error("mozilla-central directory does not exist: %s" % try_directory) 130 parser.error("mozilla-central directory does not exist: %s" % try_directory)
130 131
131 # build try syntax 132 # build try syntax
132 commit = try_syntax(**options.__dict__) 133 commit = try_syntax(opt=options.opt,
134 debug=options.debug,
135 unittests=options.unittests,
136 talos=options.talostests
137 )
133 print commit 138 print commit
134 139
135 # push to try 140 # push to try
136 push_to_try(patches=args, repo=try_directory, commit=commit) 141 push_to_try(patches=args, repo=try_directory, commit=commit)
137 142