Commit 1bb46a1e authored by Sebastien Robin's avatar Sebastien Robin

testnode: make code more robust when checkout git files (part 2)

Take into account remarks done by Julien and Vincent.
Also stop using deletePycFiles for git repositories, git clean -fdx
is doing better (it remove more useless files if needed)
parent ce3ce341
...@@ -189,16 +189,12 @@ class Updater(object): ...@@ -189,16 +189,12 @@ class Updater(object):
else: else:
h = revision[1] h = revision[1]
if h != self._git('rev-parse', 'HEAD'): if h != self._git('rev-parse', 'HEAD'):
self.deletePycFiles(self.repository_path) self._git('clean', '-fdx')
# For performance reasons, 'reset --merge' only looks at mtime & ctime # For performance, it is ok to use 'git reset --hard',
# to check is the index is correct and conflicts immediately if # theses days it is not slow like it was long time ago.
# contents or metadata changed. Even hardlinking a file changes its self._git('reset', '--hard', h)
# ctime, so at least for buildout (local download), we need to
# refresh index first.
self._git('update-index', '--refresh')
self._git('reset', '--merge', h)
else: else:
self.deletePycFiles(self.repository_path) self._git('clean', '-fdx')
if os.path.exists('.git/svn'): if os.path.exists('.git/svn'):
self._git('svn', 'rebase') self._git('svn', 'rebase')
else: else:
...@@ -211,7 +207,6 @@ class Updater(object): ...@@ -211,7 +207,6 @@ class Updater(object):
self._git('checkout', 'origin/%s' % self.branch, '-b', self._git('checkout', 'origin/%s' % self.branch, '-b',
self.branch) self.branch)
self._git('reset', '--hard', '@{u}') self._git('reset', '--hard', '@{u}')
self._git('clean', '-fdx')
self.revision = self._git_find_rev(self._git('rev-parse', 'HEAD')) self.revision = self._git_find_rev(self._git('rev-parse', 'HEAD'))
elif self.getRepositoryType() == SVN_TYPE: elif self.getRepositoryType() == SVN_TYPE:
# following code allows sparse checkout # following code allows sparse checkout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment