Browse Source

Fix checkout when preparing a ref

The new checkout method was relying on out of date information
stored in the remote which was not being updated by the fetch
command.  Instead, just checkout FETCH_HEAD using git directly
so that the remote does not need to be kept up to date.

Also, reset and clean _before_ checking out, since that's supposed
to clean up from messy merges, etc.

Change-Id: Ie47b675512edc36e8aeb9b537ca945ad8d07b780
changes/59/43959/2
James E. Blair 9 years ago
parent
commit
6eeb24743a
  1. 10
      zuul/merger.py

10
zuul/merger.py

@ -63,15 +63,13 @@ class Repo(object):
def checkout(self, ref):
self._ensure_cloned()
self.log.debug("Checking out %s" % ref)
self.log.debug(repr(ref))
self.repo.head.reset(index=True, working_tree=True)
self.repo.git.clean('-x', '-f', '-d')
if self.repo.re_hexsha_only.match(ref):
self.repo.head.reference = ref
self.repo.git.checkout(ref)
else:
self.fetch(ref)
self.repo.head.reference = \
self.repo.remotes.origin.refs[ref].commit.hexsha
self.repo.head.reset(index=True, working_tree=True)
self.repo.git.clean('-x', '-f', '-d')
self.repo.git.checkout("FETCH_HEAD")
def cherryPick(self, ref):
self._ensure_cloned()

Loading…
Cancel
Save