[jhbuild] git: Use checkoutdir tree structure below dvcs_mirror_dir
- From: Craig Keogh <cskeogh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] git: Use checkoutdir tree structure below dvcs_mirror_dir
- Date: Fri, 31 Dec 2010 01:07:12 +0000 (UTC)
commit c15d7b3b56e5b4c4b56c8d42a080a985c845f01d
Author: Dirk Wallenstein <halsmit t-online de>
Date: Tue Dec 14 11:34:46 2010 +0100
git: Use checkoutdir tree structure below dvcs_mirror_dir
Always ensure a '.git' suffix for repositories to indicate that they are
bare repositories. Extract the mirror directory calculation into a
function, as it is needed for the module when there isn't a branch yet
and it has to be recalculated when the configuration changed during a
configuration reload.
https://bugzilla.gnome.org/show_bug.cgi?id=636888
jhbuild/versioncontrol/git.py | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index dbef3b1..691a7b5 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -56,6 +56,14 @@ def get_git_extra_env():
return { 'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'),
'PATH': os.environ.get('UNMANGLED_PATH')}
+def get_git_mirror_directory(mirror_root, checkoutdir, module):
+ """Calculate the mirror directory from the arguments and return it."""
+ mirror_dir = os.path.join(mirror_root, checkoutdir or
+ os.path.basename(module))
+ if mirror_dir.endswith('.git'):
+ return mirror_dir
+ else:
+ return mirror_dir + '.git'
class GitUnknownBranchNameError(Exception):
pass
@@ -84,7 +92,8 @@ class GitRepository(Repository):
mirror_module = None
if self.config.dvcs_mirror_dir:
- mirror_module = os.path.join(self.config.dvcs_mirror_dir, module)
+ mirror_module = get_git_mirror_directory(
+ self.config.dvcs_mirror_dir, checkoutdir, module)
# allow remapping of branch for module, it supports two modes of
# operation
@@ -365,17 +374,17 @@ class GitBranch(Branch):
if self.config.nonetwork:
return
- mirror_dir = os.path.join(self.config.dvcs_mirror_dir,
- self.get_module_basename() + '.git')
+ # Calculate anew 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', 'fetch'], cwd=mirror_dir,
extra_env=get_git_extra_env())
else:
buildscript.execute(
- ['git', 'clone', '--mirror', self.unmirrored_module],
- cwd=self.config.dvcs_mirror_dir,
- extra_env=get_git_extra_env())
+ ['git', 'clone', '--mirror', self.unmirrored_module,
+ mirror_dir], extra_env=get_git_extra_env())
def _checkout(self, buildscript, copydir=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]