Files
obipipeline/.crate-kit/scripts/jjfetch.sh
T
Eric Coissac e14fb6a287
Release / release (push) Successful in 1m12s
feat: add obipipeline crate with typed multi-threaded pipelines
Introduce the `obipipeline` crate, providing typed, composable multi-threaded
pipelines with memory-bounded throttling. The crate includes a scheduler for
managing pipeline stages, a throttle mechanism for concurrency control, and
comprehensive build and release tooling via `.crate-kit`.

- Add `Cargo.toml`, `Cargo.lock`, and `Makefile` to define the `obipipeline`
  package (v0.1.1) with `crossbeam-channel` dependency and build targets.
- Add `LICENSE` and `LICENSE.en` files containing the CeCILL free software
  license agreement under French law.
- Add `.gitignore` to exclude `target` and `/.cargo/config.toml` from version
  control.
- Add `.crate-kit/` directory with build configuration (`VERSION`, `crate.mk`,
  `org.mk`, `dev-patch.mk`, `jj.mk`) and 21 shell scripts for API tracking,
  dependency management, release workflows, and wiki generation.
- Add `.gitea/workflows/release.yaml` to automate releases on tag pushes,
  including building, publishing, and updating the wiki.
- Add `src/lib.rs` to expose `scheduler` and `throttle` modules, re-exporting
  core types like `Pipe`, `Pipeline`, `WorkerPool`, and `Throttle`.
- Add `src/scheduler/` module with `error.rs` (`PipelineError`), `macros.rs`
  (`make_pipe!`, `make_pipeline!`), `pipe.rs` (`Pipe`, `PipeIter`),
  `pool.rs` (`Pipeline`, `WorkerPool`), `runner.rs` (thread runners), and
  `types.rs` (`Stage`, `WorkerTask`, function aliases).
- Add `src/throttle.rs` implementing `Throttle`, `ThrottleGuard`, and
  `throttle` function for memory-bounded concurrency control using semaphores.
- Add `api/` directory with public API snapshots (`0.1.0`, `0.1.1`) in JSON,
  text, and stamp formats for version tracking.
- Add `examples/sandbox_pipeline.rs` demonstrating pipeline construction with
  `make_pipeline!` and `WorkerPool` using sample transformation steps.
- Add `tests/pipe.rs` with tests for pipe composition, flat transforms, and
  empty input handling.
- Add `tests/throttle.rs` with tests verifying throttle ordering, concurrency
  bounds, and guard blocking behavior.
- Update `README.md` with documentation for `obipipeline`, including core
  concepts, API details, and installation instructions.
2026-12-01 19:49:09 +01:00

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