[sysadmin-bin] update_sites.py: Create local branches automatically



commit 0c62ad072b2c9d3a2821929f729c1fb8e6c8ff5c
Author: Olav Vitters <olav vitters nl>
Date:   Mon Feb 28 17:19:47 2011 +0100

    update_sites.py: Create local branches automatically

 gnomeweb/update_sites.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gnomeweb/update_sites.py b/gnomeweb/update_sites.py
index 87efdc0..5b45900 100755
--- a/gnomeweb/update_sites.py
+++ b/gnomeweb/update_sites.py
@@ -118,6 +118,9 @@ def update_modules(configfile, configdir, verbose):
                 b_url = moduleroot
                 update_module(module, b_checkfile, b_moduleroot, b_url, owner, branch=branch, 
                               real_remote_url=url, verbose=verbose)
+            if lock:
+                lock.close()
+                lock = None
         else:
             update_module(module, module, moduleroot, url, owner, verbose=verbose)
 
@@ -208,6 +211,14 @@ 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':
+            try:
+                os.chdir(url)
+                git.branch(branch, 'origin/%branch')
+            except CalledProcessError, e:
+                # local branch probably exists already
+                pass
+
     if not update_module_real(moduleroot, url, branch, verbose=verbose):
         return False
 



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