summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-08 14:45:22 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-08 14:45:22 +0100
commitef26ce410f8202ba69699ea7696058648887c71a (patch)
tree0090250a62d57632a4819d91569ad187a9cd2985 /src/backend
parent9433b5e797848546351ae3dc7602813191e01bf6 (diff)
setbranch : store the branches and remotes in a dict, simplyfying the code
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/setbranch.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py
index 5aa6a65..23b1b86 100644
--- a/src/backend/setbranch.py
+++ b/src/backend/setbranch.py
@@ -12,24 +12,30 @@ import sisyphus.setjobs
import sisyphus.setprofile
+brch_rmt_map = {
+ "master": {
+ "github": sisyphus.getfs.rmt_gh_addr,
+ "gitlab": sisyphus.getfs.rmt_gl_addr,
+ "pagure": sisyphus.getfs.rmt_pg_addr
+ },
+ "next": {
+ "github": sisyphus.getfs.rmt_gh_addr,
+ "gitlab": sisyphus.getfs.rmt_gl_addr,
+ "pagure": sisyphus.getfs.rmt_pg_addr
+ }
+}
+
+
def get_brch_rmt(branch, remote):
g_rmt = []
r_rmt = []
p_cfg_rmt = []
- if "master" in branch:
- if "github" in remote:
- remote = sisyphus.getfs.rmt_gh_addr
- elif "gitlab" in remote:
- remote = sisyphus.getfs.rmt_gl_addr
- elif "pagure" in remote:
- remote = sisyphus.getfs.rmt_pg_addr
- elif "next" in branch:
- if "github" in remote:
- remote = sisyphus.getfs.rmt_gh_addr
- elif "gitlab" in remote:
- remote = sisyphus.getfs.rmt_gl_addr
- elif "pagure" in remote:
- remote = sisyphus.getfs.rmt_pg_addr
+
+ if branch in brch_rmt_map and remote in brch_rmt_map[branch]:
+ remote = brch_rmt_map[branch][remote]
+ else:
+ # set a default remote here if needed
+ pass
g_rmt = [remote, sisyphus.getfs.g_repo]
r_rmt = [remote, sisyphus.getfs.r_repo]