|
|
@ -248,21 +248,22 @@ class Runner: |
|
|
|
self.log(mlog.red(e.output)) |
|
|
|
self.log(mlog.red(e.output)) |
|
|
|
self.log(mlog.red(str(e))) |
|
|
|
self.log(mlog.red(str(e))) |
|
|
|
return False |
|
|
|
return False |
|
|
|
try: |
|
|
|
if True: |
|
|
|
# Fetch only the revision we need, this avoids fetching useless branches. |
|
|
|
try: |
|
|
|
# revision can be either a branch, tag or commit id. In all cases we want |
|
|
|
# Fetch only the revision we need, this avoids fetching useless branches. |
|
|
|
# FETCH_HEAD to be set to the desired commit and "git checkout <revision>" |
|
|
|
# revision can be either a branch, tag or commit id. In all cases we want |
|
|
|
# to to either switch to existing/new branch, or detach to tag/commit. |
|
|
|
# FETCH_HEAD to be set to the desired commit and "git checkout <revision>" |
|
|
|
# It is more complicated than it first appear, see discussion there: |
|
|
|
# to to either switch to existing/new branch, or detach to tag/commit. |
|
|
|
# https://github.com/mesonbuild/meson/pull/7723#discussion_r488816189. |
|
|
|
# It is more complicated than it first appear, see discussion there: |
|
|
|
heads_refmap = '+refs/heads/*:refs/remotes/origin/*' |
|
|
|
# https://github.com/mesonbuild/meson/pull/7723#discussion_r488816189. |
|
|
|
tags_refmap = '+refs/tags/*:refs/tags/*' |
|
|
|
heads_refmap = '+refs/heads/*:refs/remotes/origin/*' |
|
|
|
self.git_output(['fetch', '--refmap', heads_refmap, '--refmap', tags_refmap, 'origin', revision]) |
|
|
|
tags_refmap = '+refs/tags/*:refs/tags/*' |
|
|
|
except GitException as e: |
|
|
|
self.git_output(['fetch', '--refmap', heads_refmap, '--refmap', tags_refmap, 'origin', revision]) |
|
|
|
self.log(' -> Could not fetch revision', mlog.bold(revision), 'in', mlog.bold(self.repo_dir)) |
|
|
|
except GitException as e: |
|
|
|
self.log(mlog.red(e.output)) |
|
|
|
self.log(' -> Could not fetch revision', mlog.bold(revision), 'in', mlog.bold(self.repo_dir)) |
|
|
|
self.log(mlog.red(str(e))) |
|
|
|
self.log(mlog.red(e.output)) |
|
|
|
return False |
|
|
|
self.log(mlog.red(str(e))) |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
if branch == '': |
|
|
|
if branch == '': |
|
|
|
# We are currently in detached mode |
|
|
|
# We are currently in detached mode |
|
|
|