From 08ea4ad208dcd82e88a3d3a51a08dcafb63e404e Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Fri, 28 May 2021 10:10:08 +0200
Subject: [PATCH] support GitLab MR syntax for setting std++/Iris repo and rev

---
 build-all | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/build-all b/build-all
index 61523a093..696806ad1 100755
--- a/build-all
+++ b/build-all
@@ -6,8 +6,21 @@ import requests
 # against a branch of your choice.
 # Set the GITLAB_TOKEN environment variable to a GitLab access token.
 # Set at least one of IRIS_REV or STDPP_REV to control which branches of these projects to build against
-# (default to `master`).
+# (default to default git branch). IRIS_REPO and STDPP_REPO can be used to take branches from forks.
+# Setting IRIS to "user:branch" will use the given branch on that user's fork of Iris, and similar for STDPP.
 
+# Pre-processing: we support setting `PROJECT` to `user:branch` (GitLab MR syntax),
+# which will set `PROJECT_REPO` and `PROJECT_REV` automatically.
+def preprocess_repo_rev(project):
+    var = project.upper()
+    if var in os.environ:
+        (repo, rev) = os.environ[var].split(':')
+        os.environ[var+"_REPO"] = repo + "/" + project
+        os.environ[var+"_REV"] = rev
+preprocess_repo_rev('STDPP')
+preprocess_repo_rev('IRIS')
+
+# Check if everything is set
 if not "GITLAB_TOKEN" in os.environ:
     print("You need to set the GITLAB_TOKEN environment variable to a GitLab access token.")
     print("You can create such tokens at <https://gitlab.mpi-sws.org/profile/personal_access_tokens>.")
-- 
GitLab