Debian Codegraph @

bin/lp-force-branch-mirror

raw
1 #! /usr/bin/python3
2 # vi: expandtab:sts=4
3
4 # Copyright (C) 2011 Jelmer Vernooij
5
6 """Force a new import
7 """
8
9 import optparse
10 import sys
11
12 from lptools import config
13
14
15 def main(argv):
16 parser = optparse.OptionParser('%prog [options] BRANCH...\n\n'
17 ' PROJECT is the launchpad project to inspect (eg bzr)')
18 opts, args = parser.parse_args()
19 if len(args) != 1:
20 parser.print_usage()
21 return 1
22
23 lp = config.get_launchpad("force-branch-mirror")
24 branches = lp.branches.getByUrls(urls=args)
25 for url, branch_dict in branches.items():
26 if branch_dict is None:
27 print("Branch %s not found" % url)
28 else:
29 branch = lp.load(branch_dict["self_link"])
30 print("%s: %s" % (branch.bzr_identity, branch.requestMirror()))
31
32 if __name__ == '__main__':
33 sys.exit(main(sys.argv))