changeset 519:0365b2c7ac00

don't checkout master branch by default for local branch. local would point to the local master and not to origin/master. add sanity check before git clone
author Bjoern Ricks <bricks@intevation.de>
date Wed, 10 Nov 2010 14:53:40 +0000
parents 452c5670ec6b
children 5802cec2b071
files treepkg/git.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/git.py	Wed Nov 10 13:32:37 2010 +0000
+++ b/treepkg/git.py	Wed Nov 10 14:53:40 2010 +0000
@@ -21,7 +21,7 @@
 
     """Base class for Git specific errors raised by TreePKG"""
 
-def checkout(url, localdir, branch="master"):
+def checkout(url, localdir, branch=None):
     """Clones the repository at url into the localdir"""
     run.call(cmdexpand("git clone -q $url $localdir", **locals()))
     if branch:
@@ -108,6 +108,11 @@
             self.log_info("Updating the working copy in %r", self.localdir)
             update(self.localdir, self.repository.branch)
         else:
+            # TODO: better check if localdir contains files
+            if os.path.exist(self.localdir):
+                raise GitError("Working copy dir %s already exists. " \
+                        " files. Can't checkout from %s" % (self.localdir,
+                            self.repository.url))
             self.log_info("The working copy in %r doesn't exist yet."
                           "  Checking out from %r",
                           self.localdir, self.repository.url)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)