Introduce the `.crate-kit` infrastructure to standardize build, testing, and release workflows using Jujutsu and Cargo. Add CeCILL-2.1 license files and update all workspace crate manifests with license and repository metadata. - Add `.crate-kit/` directory with `VERSION`, `crate.mk`, `dev-patch.mk`, `jj.mk`, and `org.mk` to define build targets, Jujutsu helpers, and registry configuration for the workspace. - Add 21 shell scripts in `.crate-kit/scripts/` for API tracking, dependency checking, version bumping, publishing, tagging, and wiki generation, including `common.sh` with shared utility functions. - Add `scripts/jj-tag.sh` to support tagging commits with version strings derived from the current crate version. - Add `LICENSE` and `LICENSE.en` files containing the CeCILL-2.1 free software license agreement in French and English. - Update `Makefile` with new targets for building, testing, formatting, CI, and releasing, integrating with `.crate-kit` scripts and updating the wiki directory path to `obiskim`. - Update `.gitignore` to ignore `.cargo/config.toml` files generated by the development patch system. - Add `license = "CECILL-2.1"` and `repository = "https://forge.metabarcoding.org/obi/obiskim"` to all `Cargo.toml` files in the workspace, including `obicompactvec`, `obidebruinj`, `obifastwrite`, `obikalgorithm`, `obikdump`, `obikentropy`, `obikfilter`, `obikidxcache`, `obikindex`, `obikindexer`, `obikmer`, `obikmerge`, `obikphylo`, `obikquery`, `obikrebuild`, `obikrope`, `obikselect`, `obikseq`, `obiksession`, `obikstats`, `obipipeline`, `obiread`, `obiskbuilder`, `obiskio`, `obisys`, and `obitaxonomy`. - Update `src/obikrope/Cargo.toml` to use `criterion2` version 3 with the `cargo_bench_support` feature. - Update `src/obikseq/Cargo.toml` to replace the "OnceLock-based params" feature with a new feature description involving thread-local storage. - Update `src/Cargo.lock` to reflect the version bump of `obikmer` from 1.4.7 to 1.4.8.
75 lines
3.5 KiB
Bash
Executable File
75 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Fetches the latest commits from origin WITHOUT losing local work: the mutable revisions
|
|
# sitting on the old main are rebased on top of the fetched main@origin.
|
|
#
|
|
# - local work (mutable revisions between main@origin and @, including an empty working
|
|
# copy): rebased onto main@origin;
|
|
# - work sitting on a pushed revision not yet merged into main@origin (pending
|
|
# PR): left in place, with a warning (rebasing it would cut it off from that revision);
|
|
# - working copy already contained in main@origin: we start again from a new revision on top of it.
|
|
#
|
|
# JJ_BASE (default main@origin): the base to join.
|
|
set -euo pipefail
|
|
. "$(dirname "$0")/common.sh"
|
|
|
|
base="${JJ_BASE:-main@origin}"
|
|
|
|
info "→ Fetching the latest commits..."
|
|
jj git fetch
|
|
|
|
jj log -r "$base" --no-graph -T 'change_id' >/dev/null 2>&1 || {
|
|
err "✗ $base not found after the fetch"
|
|
exit 1
|
|
}
|
|
|
|
# Local work = mutable revisions between the base and @ that are NOT already published (reachable
|
|
# from a remote bookmark): we do not rewrite what origin knows. We only keep the roots
|
|
# whose parent is already in the base's history.
|
|
work="(mutable() & ($base..@)) ~ ::remote_bookmarks()"
|
|
|
|
# A local revision rewritten AFTER its push (describe, rebase…) then merged on the server side in its
|
|
# pushed version has a twin in $base: same change id, other commit, hence a divergent
|
|
# change. We never designate a revision by its change id (jj refuses a divergent
|
|
# identifier), and we do not rebase what is already merged:
|
|
# - same content as the merged twin: the local revision is abandoned (nothing is lost);
|
|
# - different content: we stop before rewriting anything, with the course of action to follow.
|
|
for c in $(jj log --no-graph -r "($work) & divergent()" -T 'commit_id ++ "\n"'); do
|
|
cid=$(jj log --no-graph -r "$c" -T 'change_id')
|
|
twin=$(jj log --no-graph -r "change_id($cid) & ::$base" -T 'commit_id ++ "\n"' | head -n 1)
|
|
[ -n "$twin" ] || continue
|
|
short=$(jj log --no-graph -r "$c" -T 'commit_id.short(12)')
|
|
if [ -z "$(jj interdiff --from "$twin" --to "$c" --summary)" ]; then
|
|
jj abandon "$c"
|
|
ok "✓ Revision $short already merged into $base (same content): abandoned"
|
|
else
|
|
err "✗ The local revision $short has already been merged into $base in another version"
|
|
err " (same change id, different content): nothing was rewritten."
|
|
err " See the difference: jj interdiff --from $twin --to $c"
|
|
err " Keep the merged version: jj abandon $c"
|
|
err " Keep the local version: jj metaedit --update-change-id $c, then rerun"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
roots=$(jj log --no-graph -r "roots($work) & children(::$base)" -T 'commit_id ++ "\n"')
|
|
|
|
if [ -n "$roots" ]; then
|
|
args=()
|
|
for r in $roots; do args+=(-s "$r"); done
|
|
jj rebase "${args[@]}" -d "$base"
|
|
ok "✓ Local work rebased onto $base"
|
|
elif [ -n "$(jj log --no-graph -r "@ & ::$base" -T 'change_id')" ]; then
|
|
# The working copy is already part of the base: nothing to keep.
|
|
jj new "$base"
|
|
ok "✓ New revision on $base"
|
|
elif [ -n "$(jj log --no-graph -r "($base..@) & (::remote_bookmarks() | immutable())" -T 'change_id')" ]; then
|
|
warn "⚠ The work rests on pushed revisions not merged into $base (pending PR):"
|
|
warn " left in place. Merge the PR then rerun, if needed."
|
|
else
|
|
ok "✓ Already up to date on $base"
|
|
fi
|
|
|
|
if [ -n "$(jj log --no-graph -r 'conflicts() & ::@ & mutable()' -T 'change_id' 2>/dev/null)" ]; then
|
|
warn "⚠ Conflicts after the rebase: jj st, then jj resolve."
|
|
fi
|