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
This commit is contained in:
Ilya Shakhat 2014-10-07 15:13:36 +04:00
parent cecabdab57
commit 95e9cb639b

View File

@ -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: