initial commit
[ebuildfind.git] / commands / lib / layman / overlays / svn.py
blob4ff3da49e39b337d43cef189340567971db27152
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN SVN OVERLAY HANDLER
5 #################################################################################
6 # File: svn.py
8 # Handles subversion overlays
10 # Copyright:
11 # (c) 2005 - 2008 Gunnar Wrobel
12 # Distributed under the terms of the GNU General Public License v2
14 # Author(s):
15 # Gunnar Wrobel <wrobel@gentoo.org>
17 ''' Subversion overlay support.'''
19 __version__ = "$Id: svn.py 236 2006-09-05 20:39:37Z wrobel $"
21 #===============================================================================
23 # Dependencies
25 #-------------------------------------------------------------------------------
27 from layman.utils import path
28 from layman.overlays.overlay import Overlay
30 #===============================================================================
32 # Class SvnOverlay
34 #-------------------------------------------------------------------------------
36 class SvnOverlay(Overlay):
37 ''' Handles subversion overlays.'''
39 type = 'Subversion'
41 binary = '/usr/bin/svn'
43 def add(self, base, quiet = False):
44 '''Add overlay.'''
46 self.supported()
48 Overlay.add(self, base)
50 if quiet:
51 quiet_option = '-q '
52 else:
53 quiet_option = ''
55 return self.cmd(self.binary + ' co ' + quiet_option + '"' + self.src + '/" "' +
56 path([base, self.name]) + '"')
58 def sync(self, base, quiet = False):
59 '''Sync overlay.'''
61 self.supported()
63 if quiet:
64 quiet_option = '-q '
65 else:
66 quiet_option = ''
68 return self.cmd(self.binary + ' up ' + quiet_option + '"' + path([base, self.name]) +
69 '"')
71 def supported(self):
72 '''Overlay type supported?'''
74 return Overlay.supported(self, [(self.binary, 'svn',
75 'dev-util/subversion'),])