# HG changeset patch # User Bjoern Ricks # Date 1289400820 0 # Node ID 0365b2c7ac00a98ad74497a48ad7fa09ed1643f0 # Parent 452c5670ec6bf0603e0d600563fd54811d8de048 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 diff -r 452c5670ec6b -r 0365b2c7ac00 treepkg/git.py --- 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)