From 51cfd6a80e91352f509f9b117e6ee68c9e047fbb Mon Sep 17 00:00:00 2001 From: Jonas Obrist Date: Mon, 31 Oct 2011 16:06:53 +0100 Subject: [PATCH] blergh --- src/stats/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/stats/utils.py b/src/stats/utils.py index 67d2105..71b8478 100644 --- a/src/stats/utils.py +++ b/src/stats/utils.py @@ -4,6 +4,7 @@ from dulwich.client import get_transport_and_path from dulwich.repo import Repo import os +import shutil import sys class Slugifier(object): @@ -40,11 +41,10 @@ class MyModel(models.Model): def update_git(repourl, repodir): client, host_path = get_transport_and_path(repourl) + # todo: make fetch work if os.path.exists(repodir): - repo = Repo(repodir) - else: - repo = Repo.init(repodir, mkdir=True) + shutil.rmtree(repodir) + repo = Repo.init(repodir, mkdir=True) remote_refs = client.fetch(host_path, repo, - determine_wants=repo.object_store.determine_wants_all, progress=sys.stdout.write) repo["HEAD"] = remote_refs["HEAD"]