Files
OneCAD/scripts/fold-format-pending.sh
bherbruckandClaude Opus 5.5 9a07932f20 Design format: a change is one new file, never an edit to FORMAT (#1563)
A PR that saves something new adds crates/doc/src/format/pending/<name>.rs (a note, and an upgrade step if older designs must be rewritten). The build writes the next format number while changes are pending and lists them in format_pending; scripts/fold-format-pending.sh fixes them as v<N>/ at release time. Formats 23 and 24 move into v23/ and v24/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 21:13:38 -04:00

34 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Release step: give the pending design-format changes their number for good.
#
# Moves every change in crates/doc/src/format/pending/ into crates/doc/src/format/v<N>/, where N
# is the number development builds have been writing for them (the last folded format + 1).
# Commit the result with the release's version bump. Nothing to do when nothing is pending.
# See crates/doc/src/format/pending/README.md.
set -euo pipefail
root=$(git rev-parse --show-toplevel)
dir="$root/crates/doc/src/format"
last=$(sed -n 's/^const HAND_WRITTEN: u32 = \([0-9]*\);/\1/p' "$root/crates/doc/build.rs")
[ -n "$last" ] || { echo "HAND_WRITTEN not found in crates/doc/build.rs" >&2; exit 1; }
for d in "$dir"/v*/; do
[ -d "$d" ] || continue
n=${d%/}
n=${n##*/v}
if [ "$n" -gt "$last" ]; then last=$n; fi
done
shopt -s nullglob
pending=("$dir"/pending/*.rs)
if [ ${#pending[@]} -eq 0 ]; then
echo "No pending format changes: this release writes format $last."
exit 0
fi
next=$((last + 1))
mkdir -p "$dir/v$next"
git -C "$root" mv "${pending[@]}" "$dir/v$next/"
echo "Format $next is now fixed, with ${#pending[@]} change(s):"
for f in "${pending[@]}"; do echo " ${f##*/}"; done
echo "Commit crates/doc/src/format/ with the version bump."