[jhbuild] Ensure git remote is updated correctly when using a dvcs_mirror_dir



commit e58ee087e92789bd2151132cac926f31cc0102d8
Author: Carlos Alberto Lopez Perez <clopez igalia com>
Date:   Tue Nov 22 02:23:31 2016 +0100

    Ensure git remote is updated correctly when using a dvcs_mirror_dir
    
    When the URL of a git repository changes, and a directory is configured as
    dvcs_mirror_dir the local mirror needs to be updated to the new URL.
    
    Also the fetch of the remote should happen before fetching the local mirror
    into the source directory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774825

 jhbuild/versioncontrol/git.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 2f181ee..610893f 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -385,11 +385,14 @@ class GitBranch(Branch):
         if self.config.nonetwork:
             return
 
-        # Calculate anew in case a configuration reload changed the mirror root.
+        # Calculate a new in case a configuration reload changed the mirror root.
         mirror_dir = get_git_mirror_directory(self.config.dvcs_mirror_dir,
                 self.checkoutdir, self.unmirrored_module)
 
         if os.path.exists(mirror_dir):
+            buildscript.execute(['git', 'remote', 'set-url', 'origin',
+                    self.unmirrored_module], cwd=mirror_dir,
+                    extra_env=get_git_extra_env())
             buildscript.execute(['git', 'fetch'], cwd=mirror_dir,
                     extra_env=get_git_extra_env())
         else:
@@ -433,15 +436,15 @@ class GitBranch(Branch):
                 raise CommandError(_('Failed to update module as it switched to git (you should check for 
changes then remove the directory).'))
             raise CommandError(_('Failed to update module (missing .git) (you should check for changes then 
remove the directory).'))
 
+        if update_mirror:
+            self.update_dvcs_mirror(buildscript)
+
         buildscript.execute(['git', 'remote', 'set-url', 'origin',
                 self.module], **git_extra_args)
 
         buildscript.execute(['git', 'remote', 'update', 'origin'],
                 **git_extra_args)
 
-        if update_mirror:
-            self.update_dvcs_mirror(buildscript)
-
         if self.config.sticky_date:
             self.move_to_sticky_date(buildscript)
 


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