From 95e9cb639bd6bc3177c091ecc40dc51b5bb23f07 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Tue, 7 Oct 2014 15:13:36 +0400 Subject: [PATCH] Clean git repo before checkout Sometimes git repo become unusable - it contains a lot of untracked files. Due to this the following checkout fails and none of commits processed. The solution is to reset the state and clean all untracked files. Change-Id: Id230147ac3bfe739ad8be45a7f87da59807fcea4 --- stackalytics/processor/vcs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stackalytics/processor/vcs.py b/stackalytics/processor/vcs.py index e797cae90..fba610106 100644 --- a/stackalytics/processor/vcs.py +++ b/stackalytics/processor/vcs.py @@ -95,6 +95,8 @@ class Git(Vcs): def _checkout(self, branch): try: + sh.git('clean', '-d', '--force') + sh.git('reset', '--hard') sh.git('checkout', 'origin/' + branch) return True except sh.ErrorReturnCode as e: