9678.20.1
by Max Bowsher
Fix one more shebang, for new file added in devel. |
1 |
#!/usr/bin/python2.5
|
9636.4.2
by Michael Hudson
add some boilerplate |
2 |
#
|
3 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
5 |
||
6 |
import _pythonpath |
|
7 |
||
9636.4.33
by Michael Hudson
failing scripty tests |
8 |
from lp.codehosting.branchdistro import DistroBrancher |
9636.4.36
by Michael Hudson
er, hooray unit tests |
9 |
from lp.codehosting.vfs import get_multi_server |
9636.4.33
by Michael Hudson
failing scripty tests |
10 |
from lp.services.scripts.base import LaunchpadScript, LaunchpadScriptFailure |
9636.4.2
by Michael Hudson
add some boilerplate |
11 |
|
12 |
||
9636.4.10
by Michael Hudson
blah |
13 |
class BranchDistroScript(LaunchpadScript): |
9636.4.41
by Michael Hudson
address review comments |
14 |
|
9636.4.10
by Michael Hudson
blah |
15 |
usage = "%prog distro old-series new-series" |
9636.4.33
by Michael Hudson
failing scripty tests |
16 |
|
17 |
def add_my_options(self): |
|
18 |
self.parser.add_option( |
|
19 |
'--check', dest="check", action="store_true", default=False, |
|
20 |
help=("Check that the new distro series has its official " |
|
21 |
"branches set up correctly.")) |
|
22 |
||
9636.4.2
by Michael Hudson
add some boilerplate |
23 |
def main(self): |
9636.4.10
by Michael Hudson
blah |
24 |
if len(self.args) != 3: |
25 |
self.parser.error("Wrong number of arguments.") |
|
9636.4.33
by Michael Hudson
failing scripty tests |
26 |
brancher = DistroBrancher.fromNames(self.logger, *self.args) |
9719.2.13
by Michael Hudson
use direct database access for branch-distro script and tests |
27 |
server = get_multi_server( |
28 |
write_mirrored=True, write_hosted=True, direct_database=True) |
|
10197.5.9
by Michael Hudson
even more |
29 |
server.start_server() |
9636.4.36
by Michael Hudson
er, hooray unit tests |
30 |
try: |
31 |
if self.options.check: |
|
32 |
if not brancher.checkNewBranches(): |
|
33 |
raise LaunchpadScriptFailure("Check failed") |
|
34 |
else: |
|
35 |
brancher.makeNewBranches() |
|
36 |
finally: |
|
10197.5.9
by Michael Hudson
even more |
37 |
server.stop_server() |
9636.4.2
by Michael Hudson
add some boilerplate |
38 |
|
39 |
if __name__ == '__main__': |
|
9636.4.10
by Michael Hudson
blah |
40 |
BranchDistroScript("branch-distro", dbuser='branch-distro').run() |