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 |
||
11677.3.3
by Robert Collins
More edge removal. |
9 |
launchpad = Launchpad.login_with('rocketfuel-mp-status', 'production') |
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') |
|
11551.1.2
by Steve Kowalik
* Allow users to specify multiple branches to check, thanks Edwin |
14 |
if len(sys.argv) > 1: |
15 |
branches = sys.argv[1:] |
|
11551.1.3
by Steve Kowalik
Don't chdir if we specify which branches |
16 |
else: |
17 |
os.chdir(projpath) |
|
18 |
branches = os.listdir('.') |
|
11134.1.2
by Steve Kowalik
Remove a large number of egregious underscores |
19 |
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. |
20 |
|
21 |
for lb in branches: |
|
22 |
if lb == trunk: |
|
23 |
continue
|
|
24 |
try: |
|
25 |
_branch = branch.Branch.open(lb) |
|
26 |
except errors.NotBranchError: |
|
27 |
continue
|
|
28 |
print ' * %s' % lb |
|
11134.1.2
by Steve Kowalik
Remove a large number of egregious underscores |
29 |
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. |
30 |
try: |
11134.1.2
by Steve Kowalik
Remove a large number of egregious underscores |
31 |
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. |
32 |
except errors.NotBranchError: |
33 |
print ' - Remote branch does not exist' |
|
34 |
continue
|
|
11134.1.2
by Steve Kowalik
Remove a large number of egregious underscores |
35 |
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. |
36 |
print ' - Remote branch is missing revisions' |
37 |
else: |
|
38 |
print ' - Remote branch is up to date' |
|
11134.1.2
by Steve Kowalik
Remove a large number of egregious underscores |
39 |
remote = lp_branches.getByUrl(url = rem_branch_url) |
40 |
mps = remote.landing_targets |
|
41 |
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. |
42 |
print ' - MP: %s' % mp.queue_status |
43 |