2 # -*- coding: utf-8 -*-
3 #################################################################################
4 # LAYMAN MERCURIAL OVERLAY HANDLER
5 #################################################################################
8 # Handles darcs overlays
11 # (c) 2005 - 2008 Gunnar Wrobel, Andres Loeh
12 # Distributed under the terms of the GNU General Public License v2
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 #===============================================================================
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.'''
42 binary_command
= '/usr/bin/hg'
44 def add(self
, base
, quiet
= False):
49 return self
.cmd(self
.binary_command
+ ' clone "' + self
.src
+ '/" "' +
50 path([base
, self
.name
]) + '"')
52 def sync(self
, base
, quiet
= False):
57 return self
.cmd('cd "' + path([base
, self
.name
]) + '" && ' +
58 self
.binary_command
+ ' pull -u "' + self
.src
+ '"')
61 '''Overlay type supported?'''
63 return Overlay
.supported(self
, [(self
.binary_command
, 'mercurial',
64 'dev-util/mercurial'),])