2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN GIT OVERLAY HANDLER
5 #################################################################################
11 # (c) 2005 - 2008 Gunnar Wrobel, Stefan Schweizer
12 # Distributed under the terms of the GNU General Public License v2
15 # Gunnar Wrobel <wrobel@gentoo.org>
16 # Stefan Schweizer <genstef@gentoo.org>
17 ''' Git overlay support.'''
19 __version__
= "$Id: git.py 146 2006-05-27 09:52:36Z wrobel $"
21 #===============================================================================
25 #-------------------------------------------------------------------------------
27 from layman
.utils
import path
28 from layman
.overlays
.overlay
import Overlay
30 #===============================================================================
34 #-------------------------------------------------------------------------------
36 class GitOverlay(Overlay
):
37 ''' Handles git overlays.'''
41 binary_command
= '/usr/bin/git'
43 def add(self
, base
, quiet
= False):
53 # http:// should get trailing slash, other protocols shouldn't
55 if self
.src
.split(':')[0] == 'http':
57 return self
.cmd(self
.binary_command
+ ' clone ' + quiet_option
+ '"' + self
.src
+ slash
58 + '" "' + path([base
, self
.name
]) + '"')
60 def sync(self
, base
, quiet
= False):
70 return self
.cmd('cd "' + path([base
, self
.name
]) + '" && '
71 + self
.binary_command
+ ' pull' + quiet_option
)
74 '''Overlay type supported?'''
76 return Overlay
.supported(self
, [(self
.binary_command
, 'git',