~launchpad-pqm/launchpad/devel

11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
1
#!/usr/bin/python
2
3
from bzrlib import branch, errors
4
import commands
5
from launchpadlib.launchpad import Launchpad
6
import os
7
import sys
8
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
9
launchpad = Launchpad.login_with('rocketfuel-mp-status', 'edge')
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
10
trunk = commands.getoutput(
11
    '. ~/.rocketfuel-env.sh && echo $LP_TRUNK_NAME')
12
projpath = commands.getoutput(
13
    '. ~/.rocketfuel-env.sh && echo $LP_PROJECT_PATH')
14
os.chdir(projpath)
15
branches = os.listdir('.')
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
16
lp_branches = launchpad.branches
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
17
18
for lb in branches:
19
    if lb == trunk:
20
        continue
21
    try:
22
        _branch  = branch.Branch.open(lb)
23
    except errors.NotBranchError:
24
        continue
25
    print ' * %s' % lb
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
26
    rem_branch_url = _branch.get_public_branch()
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
27
    try:
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
28
        rem_branch = branch.Branch.open(rem_branch_url)
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
29
    except errors.NotBranchError:
30
        print '   - Remote branch does not exist'
31
        continue
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
32
    if _branch.revno() != rem_branch.revno():
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
33
        print '   - Remote branch is missing revisions'
34
    else:
35
        print '   - Remote branch is up to date'
11134.1.2 by Steve Kowalik
Remove a large number of egregious underscores
36
    remote = lp_branches.getByUrl(url = rem_branch_url)
37
    mps = remote.landing_targets
38
    for mp in mps:
11134.1.1 by Steve Kowalik
Add a new script that checks the status of the local versus remote branches and tells the state of any linked MPs.
39
        print '   - MP: %s' % mp.queue_status
40