Commit ed27624b authored by Boxiang Sun's avatar Boxiang Sun

testnode: Also reset the submodule when rollback the main module

parent df6414a5
......@@ -188,11 +188,15 @@ class Updater(object):
h = revision[1]
if h != self._git('rev-parse', 'HEAD'):
self._git('clean', '-fdx')
self._git('submodule', 'foreach', '--recursive', self.git_binary, 'clean', '-fdx')
# For performance, it is ok to use 'git reset --hard',
# theses days it is not slow like it was long time ago.
self._git('reset', '--hard', h)
self._git('submodule', 'foreach', '--recursive', self.git_binary, 'reset', '--hard')
self._git('submodule', 'update', '--init', '--recursive')
else:
self._git('clean', '-fdx')
self._git('submodule', 'foreach', '--recursive', self.git_binary, 'clean', '-fdx')
if os.path.exists('.git/svn'):
self._git('svn', 'rebase')
else:
......@@ -205,6 +209,8 @@ class Updater(object):
self._git('checkout', 'origin/%s' % self.branch, '-b',
self.branch)
self._git('reset', '--hard', '@{u}')
self._git('submodule', 'foreach', '--recursive', self.git_binary, 'reset', '--hard')
self._git('submodule', 'update', '--init', '--recursive')
self.revision = self._git_find_rev(self._git('rev-parse', 'HEAD'))
elif self.getRepositoryType() == SVN_TYPE:
# 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