File: lp-force-branch-mirror

package info (click to toggle)
lptools 0.3.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: python: 1,550; makefile: 6
file content (33 lines) | stat: -rwxr-xr-x 849 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/python3
# vi: expandtab:sts=4

# Copyright (C) 2011 Jelmer Vernooij

"""Force a new import
"""

import optparse
import sys

from lptools import config


def main(argv):
    parser = optparse.OptionParser('%prog [options] BRANCH...\n\n'
        '  PROJECT is the launchpad project to inspect (eg bzr)')
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.print_usage()
        return 1

    lp = config.get_launchpad("force-branch-mirror")
    branches = lp.branches.getByUrls(urls=args)
    for url, branch_dict in branches.items():
        if branch_dict is None:
            print("Branch %s not found" % url)
        else:
            branch = lp.load(branch_dict["self_link"])
            print("%s: %s" % (branch.bzr_identity, branch.requestMirror()))

if __name__ == '__main__':
    sys.exit(main(sys.argv))