[sysadmin-bin: 4/6] Update update_sites.py to not hardcode the mainline branch name
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 4/6] Update update_sites.py to not hardcode the mainline branch name
- Date: Tue, 9 Apr 2019 14:50:07 +0000 (UTC)
commit 41151e35912d2b3b4e03713d7e26820de0a2ebd9
Author: Michael Gratton <mike vee net>
Date: Thu Apr 4 00:07:31 2019 +1100
Update update_sites.py to not hardcode the mainline branch name
gnomeweb/update_sites.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gnomeweb/update_sites.py b/gnomeweb/update_sites.py
index 7821dd7..7e1468b 100755
--- a/gnomeweb/update_sites.py
+++ b/gnomeweb/update_sites.py
@@ -147,7 +147,7 @@ def try_lock(checkfile, verbose=False):
return fpl
-def update_module_real(moduleroot, url, branch='master', clone_only=False, verbose=False):
+def update_module_real(moduleroot, url, branch=None, clone_only=False, verbose=False):
# Get the latest git contents
try:
retval = 0
@@ -157,7 +157,7 @@ def update_module_real(moduleroot, url, branch='master', clone_only=False, verbo
print "Running 'git clone' to create " + moduleroot
git.clone(url, moduleroot)
os.chdir(moduleroot)
- if branch != 'master':
+ if branch != None:
if verbose:
print "Running git checkout -b", branch, "origin/" + branch
git.checkout('-b', branch, 'origin/' + branch)
@@ -173,6 +173,8 @@ def update_module_real(moduleroot, url, branch='master', clone_only=False, verbo
git.fetch('--all')
if verbose:
print "Resetting to latest content"
+ if not branch:
+ branch = get_project_head_name()
git.reset('origin/' + branch, hard=True)
except CalledProcessError, e:
print str(e)
@@ -181,7 +183,7 @@ def update_module_real(moduleroot, url, branch='master', clone_only=False, verbo
return True
-def update_module(module, checkfile, moduleroot, url, owner, branch='master', verbose=False,
real_remote_url=None):
+def update_module(module, checkfile, moduleroot, url, owner, branch=None, verbose=False,
real_remote_url=None):
# Compare timestamps
if verbose:
print "Checking '" + module + "'..."
@@ -217,7 +219,10 @@ def update_module(module, checkfile, moduleroot, url, owner, branch='master', ve
# Update the original module first, then update this module
if not update_module_real(url, real_remote_url, verbose=verbose):
return False
- if branch != 'master' and not os.path.exists(os.path.join(moduleroot, ".git")):
+ mainline = get_project_head_name()
+ if not branch:
+ branch = mainline
+ if branch != mainline and not os.path.exists(os.path.join(moduleroot, ".git")):
try:
os.chdir(url)
git.branch(branch, 'origin/%s' % branch)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]