aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-20 11:16:07 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-20 11:29:43 +0000
commit19b9da7bed9416f323793e9c1c7326b483b3d57f (patch)
tree75333658d443ef702385ef64d9af183fc5fb9962 /setup.py
parentd8575a3ea986a6966cd01e0fa035ca9d426a6736 (diff)
setup.py: Create a tracking branch for version unless it exists
Change-Id: Ie7832668e0a4adf4dcbf78e49c2af4b65ebe5107 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index a3178a13c..2eac4dacc 100644
--- a/setup.py
+++ b/setup.py
@@ -370,11 +370,21 @@ def prepareSubModules():
module_dir = m[2]
os.chdir(module_dir)
currentBranch = ''
+ branches = set()
for line in run_process_output(['git', 'branch']):
if line.startswith('* '):
currentBranch = line[2:len(line)]
- break
+ else:
+ branches.add(line.strip())
if currentBranch != module_version:
+ if not module_version in branches:
+ print("Creating tracking branch %s for submodule %s" % \
+ (module_version, module_name))
+ git_create_branch_cmd = ["git", "branch", "--track", module_version,
+ "origin/" + module_version]
+ if run_process(git_create_branch_cmd) != 0:
+ raise DistutilsSetupError("Failed to create a tracking branch %s for %s" % \
+ (module_version, module_name))
print("Checking out submodule %s to branch %s (from %s)" % (module_name, module_version, currentBranch))
git_checkout_cmd = ["git", "checkout", module_version]
if run_process(git_checkout_cmd) != 0: