Lines 159-164
fi
Link Here
|
159 |
# |
159 |
# |
160 |
# It can be overriden via env using ${PN}_LIVE_COMMIT variable. |
160 |
# It can be overriden via env using ${PN}_LIVE_COMMIT variable. |
161 |
|
161 |
|
|
|
162 |
# @ECLASS-VARIABLE: EGIT_COMMIT_DATE |
163 |
# @DEFAULT_UNSET |
164 |
# @DESCRIPTION: |
165 |
# Attempt to check out the repository state for the specified timestamp. |
166 |
# The date should be in format understood by 'git rev-list'. |
167 |
# |
168 |
# The eclass will select the last commit with commit date preceding |
169 |
# the specified date. When merge commits are found, only first parents |
170 |
# will be considered in order to avoid switching into external branches |
171 |
# (assuming that merges are done correctly). In other words, each merge |
172 |
# will be considered alike a single commit with date corresponding |
173 |
# to the merge commit date. |
174 |
# |
175 |
# It can be overriden via env using ${PN}_LIVE_COMMIT_DATE variable. |
176 |
|
162 |
# @ECLASS-VARIABLE: EGIT_CHECKOUT_DIR |
177 |
# @ECLASS-VARIABLE: EGIT_CHECKOUT_DIR |
163 |
# @DESCRIPTION: |
178 |
# @DESCRIPTION: |
164 |
# The directory to check the git sources out to. |
179 |
# The directory to check the git sources out to. |
Lines 254-259
_git-r3_env_setup() {
Link Here
|
254 |
[[ ${!livevar} ]] \ |
269 |
[[ ${!livevar} ]] \ |
255 |
&& ewarn "Using ${livevar}, no support will be provided" |
270 |
&& ewarn "Using ${livevar}, no support will be provided" |
256 |
|
271 |
|
|
|
272 |
livevar=${esc_pn}_LIVE_COMMIT_DATE |
273 |
EGIT_COMMIT_DATE=${!livevar-${EGIT_COMMIT_DATE}} |
274 |
[[ ${!livevar} ]] \ |
275 |
&& ewarn "Using ${livevar}, no support will be provided" |
276 |
|
277 |
if [[ ${EGIT_COMMIT} && ${EGIT_COMMIT_DATE} ]]; then |
278 |
die "EGIT_COMMIT and EGIT_COMMIT_DATE can not be specified simultaneously" |
279 |
fi |
280 |
|
257 |
# Migration helpers. Remove them when git-2 is removed. |
281 |
# Migration helpers. Remove them when git-2 is removed. |
258 |
|
282 |
|
259 |
if [[ ${EGIT_SOURCEDIR} ]]; then |
283 |
if [[ ${EGIT_SOURCEDIR} ]]; then |
Lines 495-501
_git-r3_is_local_repo() {
Link Here
|
495 |
} |
519 |
} |
496 |
|
520 |
|
497 |
# @FUNCTION: git-r3_fetch |
521 |
# @FUNCTION: git-r3_fetch |
498 |
# @USAGE: [<repo-uri> [<remote-ref> [<local-id>]]] |
522 |
# @USAGE: [<repo-uri> [<remote-ref> [<local-id> [<commit-date>]]]] |
499 |
# @DESCRIPTION: |
523 |
# @DESCRIPTION: |
500 |
# Fetch new commits to the local clone of repository. |
524 |
# Fetch new commits to the local clone of repository. |
501 |
# |
525 |
# |
Lines 518-523
_git-r3_is_local_repo() {
Link Here
|
518 |
# This default should be fine unless you are fetching multiple trees |
542 |
# This default should be fine unless you are fetching multiple trees |
519 |
# from the same repository in the same ebuild. |
543 |
# from the same repository in the same ebuild. |
520 |
# |
544 |
# |
|
|
545 |
# <commit-id> requests attempting to use repository state as of specific |
546 |
# date. For more details, see EGIT_COMMIT_DATE. |
547 |
# |
521 |
# The fetch operation will affect the EGIT_STORE only. It will not touch |
548 |
# The fetch operation will affect the EGIT_STORE only. It will not touch |
522 |
# the working copy, nor export any environment variables. |
549 |
# the working copy, nor export any environment variables. |
523 |
# If the repository contains submodules, they will be fetched |
550 |
# If the repository contains submodules, they will be fetched |
Lines 538-543
git-r3_fetch() {
Link Here
|
538 |
local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}} |
565 |
local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}} |
539 |
local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}} |
566 |
local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}} |
540 |
local local_ref=refs/git-r3/${local_id}/__main__ |
567 |
local local_ref=refs/git-r3/${local_id}/__main__ |
|
|
568 |
local commit_date=${4:-${EGIT_COMMIT_DATE}} |
541 |
|
569 |
|
542 |
[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset" |
570 |
[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset" |
543 |
|
571 |
|
Lines 621-626
git-r3_fetch() {
Link Here
|
621 |
fi |
649 |
fi |
622 |
fi |
650 |
fi |
623 |
|
651 |
|
|
|
652 |
# checkout by date does not make sense in shallow mode |
653 |
if [[ ${commit_date} && ${clone_type} == shallow ]]; then |
654 |
clone_type=single |
655 |
fi |
656 |
|
624 |
if [[ ${fetch_l} == HEAD ]]; then |
657 |
if [[ ${fetch_l} == HEAD ]]; then |
625 |
fetch_r=refs/git-r3/HEAD |
658 |
fetch_r=refs/git-r3/HEAD |
626 |
else |
659 |
else |
Lines 667-683
git-r3_fetch() {
Link Here
|
667 |
fi |
700 |
fi |
668 |
|
701 |
|
669 |
# now let's see what the user wants from us |
702 |
# now let's see what the user wants from us |
670 |
local full_remote_ref=$( |
703 |
if [[ ${commit_date} ]]; then |
671 |
git rev-parse --verify --symbolic-full-name "${remote_ref}" |
704 |
local dated_commit_id=$( |
672 |
) |
705 |
git rev-list --first-parent --before="${commit_date}" \ |
673 |
|
706 |
-n 1 "${remote_ref}" |
674 |
if [[ ${full_remote_ref} ]]; then |
707 |
) |
675 |
# when we are given a ref, create a symbolic ref |
708 |
if [[ ${?} -ne 0 ]]; then |
676 |
# so that we preserve the actual argument |
709 |
die "Listing ${remote_ref} failed (wrong ref?)." |
677 |
set -- git symbolic-ref "${local_ref}" "${full_remote_ref}" |
710 |
elif [[ ! ${dated_commit_id} ]]; then |
|
|
711 |
die "Unable to find commit for date ${commit_date}." |
712 |
else |
713 |
set -- git update-ref --no-deref "${local_ref}" "${dated_commit_id}" |
714 |
fi |
678 |
else |
715 |
else |
679 |
# otherwise, we were likely given a commit id |
716 |
local full_remote_ref=$( |
680 |
set -- git update-ref --no-deref "${local_ref}" "${remote_ref}" |
717 |
git rev-parse --verify --symbolic-full-name "${remote_ref}" |
|
|
718 |
) |
719 |
|
720 |
if [[ ${full_remote_ref} ]]; then |
721 |
# when we are given a ref, create a symbolic ref |
722 |
# so that we preserve the actual argument |
723 |
set -- git symbolic-ref "${local_ref}" "${full_remote_ref}" |
724 |
else |
725 |
# otherwise, we were likely given a commit id |
726 |
set -- git update-ref --no-deref "${local_ref}" "${remote_ref}" |
727 |
fi |
681 |
fi |
728 |
fi |
682 |
|
729 |
|
683 |
echo "${@}" >&2 |
730 |
echo "${@}" >&2 |
684 |
- |
|
|