[sysadmin-bin] Get repo owner from env, simplify branches logic



commit 5300f8b17bb0a1a1185fa46a301e5c494c76039d
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Jul 14 14:06:14 2020 +0200

    Get repo owner from env, simplify branches logic

 git/post-receive-mirror-github | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index d48b912..5409723 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -149,7 +149,7 @@ def get_doap_settings(repo_name):
     nss = {'doap': 'http://usefulinc.com/ns/doap#',
            'rdf':  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'}
 
-    repo_owner = os.path.dirname(os.getcwd()).split('/')[-1]
+    repo_owner = os.getenv('NAMESPACE')
 
     # Get the repo's mainline branch name
     branch_name = get_project_head_name()
@@ -224,13 +224,13 @@ def main():
     if github_settings['homepage'] != doap_settings['homepage']:
         gh.update_github_repo(repo_name, 'homepage', doap_settings["homepage"])
 
+    command = "git push git github com:{}/{} {}".format(gh.organization, github_repo_name, 
doap_settings['default_branch'])
+    run_command(command)
+    gh.update_github_repo(repo_name, 'default_branch', doap_settings['default_branch'])
+
     push_command = "git push --mirror git github com:{}/{}".format(gh.organization, github_repo_name)
     run_command(push_command)
 
-    gh.update_github_repo(repo_name, 'default_branch', doap_settings['default_branch'])
-    if doap_settings['default_branch'] != 'mainline':
-        run_command("git push --force git github com:{}/{} :mainline".format(gh.organization, 
github_repo_name))
-
     for org in ADDITIONAL_ORGANIZATIONS.get(repo_name, []):
         run_command("git push --mirror git github com:{}/{}".format(org, github_repo_name))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]