[jhbuild] git: Fix switching to the currently configured dvcs-mirror



commit 6bf672ba41b334dfd5c849eef90f0e52dc3073f3
Author: Dirk Wallenstein <halsmit t-online de>
Date:   Mon Apr 11 19:29:56 2011 +0200

    git: Fix switching to the currently configured dvcs-mirror
    
    This takes the commands introduced by d1d8a2c and executes a single call
    at the start of each update operation.  The repository will use the
    mirror currently defined in jhbuildrc or the online location.
    
    Previously it was not possible to switch from the online URL to a local
    dvcs-mirror.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=647537

 jhbuild/versioncontrol/git.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index bcf0318..80c6070 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -289,9 +289,6 @@ class GitBranch(Branch):
             buildscript.execute(['git', 'stash', 'save', 'jhbuild-stash'],
                     **git_extra_args)
 
-        if not self.config.dvcs_mirror_dir:
-            buildscript.execute(['git', 'remote', 'set-url', 'origin',
-                self.module], **git_extra_args)
         buildscript.execute(['git', 'pull', '--rebase'], **git_extra_args)
 
         if stashed:
@@ -382,8 +379,6 @@ class GitBranch(Branch):
                 self.checkoutdir, self.unmirrored_module)
 
         if os.path.exists(mirror_dir):
-            buildscript.execute(['git', 'remote', 'set-url', 'origin',
-                self.unmirrored_module], cwd=mirror_dir, **git_extra_args)
             buildscript.execute(['git', 'fetch'], cwd=mirror_dir,
                     extra_env=get_git_extra_env())
         else:
@@ -422,6 +417,9 @@ 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).'))
 
+        buildscript.execute(['git', 'remote', 'set-url', 'origin',
+                self.module], **git_extra_args)
+
         if update_mirror:
             self.update_dvcs_mirror(buildscript)
 



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