commit: ef6f5893a333684f3b73e04e486b02b60559c512
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Mon May 26 22:22:33 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 12 21:11:49 2014 +0000
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=ef6f5893
svn.py: Adds update() function
Adds _fix_svn_source() function to correct the source url in
order to run the svn switch --relocate command.
---
layman/overlays/svn.py | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/layman/overlays/svn.py b/layman/overlays/svn.py
index 0244dd4..f494eba 100644
--- a/layman/overlays/svn.py
+++ b/layman/overlays/svn.py
@@ -53,6 +53,18 @@ class SvnOverlay(OverlaySource):
parent, config, _location, ignore)
self.subpath = None
+ def _fix_svn_source(self, source):
+ '''
+ Adds @ to all sources that don't already include it.
+
+ @params source: source URL, string.
+ '''
+ if source.endswith("/"):
+ source = source + '@'
+ else:
+ source = source +'/@'
+ return source
+
def add(self, base):
'''Add overlay.'''
@@ -70,11 +82,7 @@ class SvnOverlay(OverlaySource):
if len(cfg_opts):
args.append(cfg_opts)
- if self.src.endswith("/"):
- src = self.src + '@'
- else:
- src = self.src + '/@'
-
+ src = self._fix_svn_source(self.src)
args.append(src)
args.append(self.target)
@@ -82,6 +90,25 @@ class SvnOverlay(OverlaySource):
self.run_command(self.command(), args, cmd=self.type),
cwd=self.target)
+ def update(self, base, src):
+ '''
+ Update overlay src-url
+
+ @params base: base location where all overlays are installed.
+ @params src: source URL.
+ '''
+
+ self.output.debug("svn.update(); starting...%s" % self.parent.name, 6)
+ target = path([base, self.parent.name])
+
+ # svn switch --relocate <oldurl> <newurl>
+ args = ['switch', '--relocate', self._fix_svn_source(self.src),
self._fix_svn_source(src)]
+
+ return self.postsync(
+ self.run_command(self.command(), args, cmd=self.type),
+ cwd=target)
+
+
def sync(self, base):
'''Sync overlay.'''