3944.1.1
by Francis J. Lacoste
Use system version python2.4 for scripts. |
1 |
#!/usr/bin/python2.4
|
8687.15.7
by Karl Fogel
Add the copyright header block to more files. |
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 |
||
4935.3.7
by Curtis Hovey
Added bad name suppression to cronscripts. |
6 |
# pylint: disable-msg=C0103,W0403
|
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
7 |
# Author: Gustavo Niemeyer <gustavo@niemeyer.net>
|
3249.6.1
by David Allouche
branch-scanner.py renaming and ScriptsAndDaemons compliance |
8 |
# David Allouche <david@allouche.net>
|
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
9 |
|
10 |
"""Update bzr branches information in the database"""
|
|
11 |
||
12 |
||
13 |
import _pythonpath |
|
14 |
import logging |
|
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
15 |
|
8426.6.1
by Michael Hudson
bzr ls --versioned --recursive --kind=file | xargs sed -i -e 's,from canonical.codehosting,from lp.codehosting,' |
16 |
from lp.codehosting.scanner.branch_scanner import BranchScanner |
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
17 |
from canonical.config import config |
8356.1.1
by Leonard Richardson
Partial move. |
18 |
from lp.services.scripts.base import LaunchpadCronScript |
5899.1.13
by Curtis Hovey
Added the remaining conf keys for oopses. |
19 |
from canonical.launchpad.webapp.errorlog import globalErrorUtility |
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
20 |
|
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
21 |
|
4264.2.1
by James Henstridge
add a LaunchpadCronScript subclass, and make cronscripts/*.py use it |
22 |
class UpdateBranches(LaunchpadCronScript): |
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
23 |
def main(self): |
24 |
# We don't want debug messages from bzr at that point.
|
|
25 |
bzr_logger = logging.getLogger("bzr") |
|
26 |
bzr_logger.setLevel(logging.INFO) |
|
5899.1.13
by Curtis Hovey
Added the remaining conf keys for oopses. |
27 |
globalErrorUtility.configure('branchscanner') |
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
28 |
|
29 |
BranchScanner(self.txn, self.logger).scanAllBranches() |
|
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
30 |
|
3109.3.1
by David Allouche
improve logging in update-branches.py |
31 |
|
2841.1.1
by Gustavo Niemeyer
Implementing update-branches cronscript. |
32 |
if __name__ == '__main__': |
5899.1.13
by Curtis Hovey
Added the remaining conf keys for oopses. |
33 |
script = UpdateBranches( |
34 |
"updatebranches", dbuser=config.branchscanner.dbuser) |
|
3691.348.13
by kiko
Convert a couple of cronscripts over to LaunchpadScript |
35 |
script.lock_and_run() |
36 |