Mercurial > mozilla > hg > MozillaTry
annotate mozillatry.py @ 9:8c8a223e4df2
begin to read config file
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 04 Dec 2012 15:13:26 -0800 |
parents | 7423fa8b4343 |
children | f0bca08e296a |
rev | line source |
---|---|
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 """ |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 push patches to try |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 """ |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 |
4
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
7 import configuration |
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 import optparse |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
9 import os |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
10 import sys |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 from subprocess import check_call as call |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 def reset(directory): |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
15 """reset an hg directory to a good state""" |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
16 assert os.path.exists(directory) and os.path.isdir(directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
17 hg_dir = os.path.join(directory, '.hg') |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
18 assert os.path.exists(hg_dir) and os.path.isdir(hg_dir) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 call(['hg', 'revert', '--no-backup', '--all'], cwd=directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 call(['hg', 'qpop', '--all'], cwd=directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 try: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 shutil.rmtree(os.path.join(hg_dir, 'patches')) # remove patches |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 except: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 pass |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 def update(directory): |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 """update a mozilla-central checkout""" |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 assert os.path.exists(directory) and os.path.isdir(directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
29 reset(directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
30 call(['hg', 'pull'], cwd=directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
31 call(['hg', 'update'], cwd=directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 call(['hg', 'qinit'], cwd=directory) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
33 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
34 def push_to_try(patches, repo, commit, _try='ssh://hg.mozilla.org/try/'): |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
35 """push a series of patches to try repository""" |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
36 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
37 # ensure the repo is in a good state |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
38 update(repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
39 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
40 try: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
41 # apply patches |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
42 for patch in patches: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
43 call(['hg', 'qimport', patch], cwd=repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
44 call(['hg', 'qpush', '--all'], cwd=repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
45 call(['hg', 'qseries', '-v'], cwd=repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
46 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
47 # push to try |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
48 call(['hg', 'qref', '--message', commit], cwd=repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
49 call(['hg', 'push', '-f', _try], cwd=repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
50 finally: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
51 reset(repo) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
52 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
53 def try_syntax(opt=True, debug=True, unittests=('all'), talos=('all'), bug=None): |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
54 """ |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
55 return try syntax; see also: |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
56 - https://github.com/pbiggar/trychooser |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
57 - http://trychooser.pub.build.mozilla.org/ |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
58 """ |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
59 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
60 assert opt or debug |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
61 message = ['try:'] |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
62 message += ['-b', '%s%s' % (('d' if debug else ''), ('o' if opt else ''))] |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
63 message += ['-u', (','.join(unittests) if unittests else 'none')] |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
64 message += ['-t', (','.join(talos) if talos else 'none')] |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
65 if bug: |
6
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
66 message += ['--post-to-bugzilla', 'Bug', str(bug)] |
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
67 return ' '.join(message) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
68 |
7
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
69 ### configuration parsing |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
70 |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
71 class ConfigurationError(Exception): |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
72 """error when checking configuration""" |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
73 |
4
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
74 class MozillaTryConfiguration(configuration.Configuration): |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
75 |
9 | 76 default_config_file = os.path.join('~', '.mozutils.yaml') |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
77 usage = '%prog [options] patch <patch2> <...>' |
9 | 78 load_help = 'load from config file' |
79 if os.path.exists(os.path.expanduser(default_config_file)): | |
80 usage += ' [DEFAULT: %s]' % default_config_file | |
4
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
81 options = {'opt': {'default': True, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
82 'help': "whether to try on opt builds"}, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
83 'debug': {'default': True, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
84 'help': "whether to try on debug builds"}, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
85 'unittests': {'default': [], |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
86 'help': "unit tests to run", |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
87 'flags': ['-u', '--unittests']}, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
88 'talostests': {'default': [], |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
89 'help': "talos tests to run", |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
90 'flags': ['-t', '--talostests']}, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
91 'mozilla_central': {'help': "path to mozilla-central clone", |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
92 'required': True, |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
93 'flags': ["--m-c", "--mozilla-central"]} |
14275dcbff10
begin switching to configuration package
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
94 } |
2
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
95 |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
96 def __init__(self): |
6
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
97 configuration.Configuration.__init__(self, usage=self.usage, load='--config') |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
98 |
8 | 99 def validate(self): |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
100 """check configuration""" |
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
101 |
8 | 102 configuration.Configuration.validate(self) |
103 | |
104 if (not self.config.get('opt')) and (not self.config.get('debug')): | |
7
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
105 raise ConfigurationError("Must have opt or debug builds") |
5
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
106 |
416f4562005c
more switching to configuration parser
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
107 |
2
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
108 def read_config(filename, options): |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
109 """read .mozutils config file and substitute for options if None""" |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
110 |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
111 # XXX stub; this should really use |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
112 # e.g. http://k0s.org/mozilla/hg/configuration/ |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
113 from ConfigParser import ConfigParser |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
114 parser = ConfigParser() |
3 | 115 if not os.path.exists(filename): |
116 return parser | |
2
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
117 parser.read(filename) |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
118 if options.mozilla_central is None: |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
119 try: |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
120 path = parser.get('hg', 'mozilla-central') |
3 | 121 if path: |
122 options.mozilla_central = os.path.expanduser(path) | |
2
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
123 except Exception: # XXX temporary hack |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
124 pass |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
125 return parser |
1
0f8e4a3b4e1c
split add_options to its own method for consumption
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
126 |
3 | 127 |
1
0f8e4a3b4e1c
split add_options to its own method for consumption
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
128 |
0f8e4a3b4e1c
split add_options to its own method for consumption
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
129 def main(args=sys.argv[1:]): |
0f8e4a3b4e1c
split add_options to its own method for consumption
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
130 |
0f8e4a3b4e1c
split add_options to its own method for consumption
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
131 # parse command line arguments |
6
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
132 parser = MozillaTryConfiguration() |
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
133 options, args = parser.parse_args() |
7
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
134 if not args: |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
135 parser.print_usage() |
51d1167cc684
something still wrong here but on the right track, i hope
Jeff Hammel <jhammel@mozilla.com>
parents:
6
diff
changeset
|
136 parser.exit() |
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
137 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
138 # get mozilla-central repository directory |
2
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
139 try_directory = options.mozilla_central |
3eaee0d10880
make getting mozilla-central slightly less of a hack; soon, we should transition to configuration to make this nice, though lets build the API around it first for now
Jeff Hammel <jhammel@mozilla.com>
parents:
1
diff
changeset
|
140 if (try_directory is None) or (not os.path.exists(try_directory)): |
3 | 141 parser.error("mozilla-central directory does not exist: %s" % try_directory) |
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
142 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
143 # build try syntax |
6
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
144 commit = try_syntax(opt=options.opt, |
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
145 debug=options.debug, |
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
146 unittests=options.unittests, |
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
147 talos=options.talostests |
6f35d0d90c64
move more to configuration land
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
148 ) |
0
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
149 print commit |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
150 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
151 # push to try |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
152 push_to_try(patches=args, repo=try_directory, commit=commit) |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
153 |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
154 if __name__ == '__main__': |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
155 main() |
df6a8049e9a4
initial port from http://k0s.org/mozilla/try.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
156 |