aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-03 17:21:12 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-03 17:21:12 +0200
commit3dac8f9086fdde5a9d5380c454bb9cef85451db6 (patch)
tree457d00bb48db0d33e4ffc05c341e214503d7b30d /MgaRepo
parentaa0a44ce356b31a44c4b41866259bb7a01e7a478 (diff)
downloadmgarepo-3dac8f9086fdde5a9d5380c454bb9cef85451db6.tar
mgarepo-3dac8f9086fdde5a9d5380c454bb9cef85451db6.tar.gz
mgarepo-3dac8f9086fdde5a9d5380c454bb9cef85451db6.tar.bz2
mgarepo-3dac8f9086fdde5a9d5380c454bb9cef85451db6.tar.xz
mgarepo-3dac8f9086fdde5a9d5380c454bb9cef85451db6.zip
check whether target path contains either of svn or git repo
Diffstat (limited to 'MgaRepo')
-rw-r--r--MgaRepo/git.py7
-rw-r--r--MgaRepo/svn.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/MgaRepo/git.py b/MgaRepo/git.py
index b91dcb2..07d57ac 100644
--- a/MgaRepo/git.py
+++ b/MgaRepo/git.py
@@ -18,9 +18,9 @@ class GITLogEntry(VCSLogEntry):
class GIT(VCS):
vcs_dirname = ".git"
+ vcs_name = "git"
def __init__(self):
VCS.__init__(self)
- self.vcs_name = "git"
self.vcs_command = config.get("global", "git-command", ["git"])
self.vcs_supports['clone'] = True
self.env_defaults = {"GIT_SSH": self.vcs_wrapper}
@@ -42,8 +42,9 @@ class GIT(VCS):
return True
def clone(self, url, targetpath, fullnames=True, **kwargs):
- if lexists(join(targetpath, SVN.vcs_dirname)):
- raise Error("Target path %s already contains svn checkout, aborting..." % targetpath)
+ for vcs in (SVN, GIT):
+ if lexists(join(targetpath, vcs.vcs_dirname)):
+ raise Error("target path %s already contains %s repository, aborting..." % (targetpath, vcs.vcs_name))
if url.split(':')[0].find("svn") < 0:
return VCS.clone(self, url, **kwargs)
else:
diff --git a/MgaRepo/svn.py b/MgaRepo/svn.py
index 120c19c..a9038df 100644
--- a/MgaRepo/svn.py
+++ b/MgaRepo/svn.py
@@ -13,9 +13,9 @@ class SVNLogEntry(VCSLogEntry):
class SVN(VCS):
vcs_dirname = ".svn"
+ vcs_name = "svn"
def __init__(self):
VCS.__init__(self)
- self.vcs_name = "svn"
self.vcs_command = config.get("global", "svn-command", ["svn"])
self.env_defaults = {"SVN_SSH": self.vcs_wrapper}