forked from jfaust/qt5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_st_to_github.py
36 lines (28 loc) · 1.01 KB
/
push_st_to_github.py
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
34
35
36
import os
import os.path
import subprocess
import sys
import argparse
modules = [
'qtbase',
'qtdeclarative',
'qtmultimedia',
'qtquickcontrols',
'qtwebkit',
]
def has_branch(branch, modulepath):
return subprocess.call(['git', 'show-ref', '--verify', '--quiet', 'refs/heads/%s' % branch], cwd=modulepath) == 0
parser = argparse.ArgumentParser()
parser.add_argument("branch", help="Branch to push upstream")
args = parser.parse_args()
for m in modules:
modulepath = os.path.abspath(m)
remote_path = '[email protected]:suitabletech/%s' % m
st_branch = 'st-%s' % args.branch
st_staging_branch = 'st-%s-staging' % args.branch
if has_branch(st_branch, modulepath):
print 'Pushing %s to %s' % (st_branch, remote_path)
subprocess.check_call(['git', 'push', remote_path, st_branch], cwd=modulepath)
if has_branch(st_staging_branch, modulepath):
print 'Pushing %s to %s' % (st_staging_branch, remote_path)
subprocess.check_call(['git', 'push', remote_path, st_staging_branch], cwd=modulepath)