initial commit
[ebuildfind.git] / commands / lib / layman / overlays / mercurial.py
blobb010c8be014112326df522de42cfa929efcbd66c
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN MERCURIAL OVERLAY HANDLER
5 #################################################################################
6 # File: darcs.py
8 # Handles darcs overlays
10 # Copyright:
11 # (c) 2005 - 2008 Gunnar Wrobel, Andres Loeh
12 # Distributed under the terms of the GNU General Public License v2
14 # Author(s):
15 # Gunnar Wrobel <wrobel@gentoo.org>
16 # Andres Loeh <kosmikus@gentoo.org>
18 ''' Mercurial overlay support.'''
20 __version__ = "$Id: mercurial.py 236 2006-09-05 20:39:37Z wrobel $"
22 #===============================================================================
24 # Dependencies
26 #-------------------------------------------------------------------------------
28 from layman.utils import path
29 from layman.overlays.overlay import Overlay
31 #===============================================================================
33 # Class MercurialOverlay
35 #-------------------------------------------------------------------------------
37 class MercurialOverlay(Overlay):
38 ''' Handles mercurial overlays.'''
40 type = 'Mercurial'
42 binary_command = '/usr/bin/hg'
44 def add(self, base, quiet = False):
45 '''Add overlay.'''
47 self.supported()
49 return self.cmd(self.binary_command + ' clone "' + self.src + '/" "' +
50 path([base, self.name]) + '"')
52 def sync(self, base, quiet = False):
53 '''Sync overlay.'''
55 self.supported()
57 return self.cmd('cd "' + path([base, self.name]) + '" && ' +
58 self.binary_command + ' pull -u "' + self.src + '"')
60 def supported(self):
61 '''Overlay type supported?'''
63 return Overlay.supported(self, [(self.binary_command, 'mercurial',
64 'dev-util/mercurial'),])