[Treepkg-commits] r482 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 10 15:53:42 CET 2010


Author: bricks
Date: 2010-11-10 15:53:40 +0100 (Wed, 10 Nov 2010)
New Revision: 482

Modified:
   trunk/treepkg/git.py
Log:
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


Modified: trunk/treepkg/git.py
===================================================================
--- trunk/treepkg/git.py	2010-11-10 13:32:37 UTC (rev 481)
+++ trunk/treepkg/git.py	2010-11-10 14:53:40 UTC (rev 482)
@@ -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)



More information about the Treepkg-commits mailing list