Commands
julia --project=. bin/upstream-sync.jl [--config FILE] [--cache DIR] <command> ...With just: just check, just import giac 2.1.0 ../giac, just tag giac 2.1.0 ../giac, just merge-plan giac 2.1.0 ../giac, just export giac ../giac.
check [NAME] [--repo PATH|URL] [--github-output]
Lists the release versions found in the upstream index, the latest one and the latest imported one (the highest upstream/X.Y.Z tag, read with git ls-remote --tags from the GitHub repository, or from --repo), and reports whether a newer release exists. Without NAME, every configured upstream is checked. --github-output appends new_releases=<name> <X.Y.Z>,... and status=... to $GITHUB_OUTPUT.
import NAME X.Y.Z --repo PATH [--force] [--offline] [--allow-stale]
In a local clone of the fork:
- downloads
giac-X.Y.Z.tar.gzandmd5sum.txt(the tarball is cached incache/, or$UPSTREAM_SYNC_CACHE, and reused; the checksum file is always refreshed unless--offline) and verifies the checksum; - extracts the tarball and strips its top directory;
- creates the branch
upstream-import/X.Y.Zfrommainwith one commit whose tree is exactly the tarball (bytes as published: no.gitignore,.gitattributesor end-of-line filtering; file modes from the tar headers) plus the kept paths ofmain. The commit is "import upstream giac X.Y.Z", with the source URL, the checksum and the tree hash (Tree: <hash>) in its body; author and committer are your local git identity.
It does not tag: the pull request may be merged with a method that rewrites the commit (squash, rebase), so the tag is created afterwards by tag.
The working tree and index of the clone are not touched (the commit is built with a temporary index). Nothing is pushed; the next steps are printed. --force replaces an existing branch and tag.
The import refuses to start when the local main differs from main on origin (read with git ls-remote origin): an import based on a stale main would, for instance, drop the kept .github/ files committed since. Update it first (git fetch origin main:main) or pass --allow-stale.
tag NAME X.Y.Z --repo PATH [--force] [--offline]
Run once the import pull request is merged, with any merge method:
- fetches
mainfromorigin(unless--offline); - finds the commit of
origin/mainwith the tree of the import: the import commit itself if it is onmain(merge commit, fast-forward), otherwise the oldest commit with the same tree (squash, rebase). The import tree is read from theupstream-import/X.Y.Zbranch (local ororigin/), or, if that branch was deleted, from the "import upstream giac X.Y.Z" commit onmain(itsTree:line, or its own tree); - creates the annotated tag
upstream/X.Y.Zthere, with the source URL and checksum of the import.
It refuses when no commit of main has that tree (pull request not merged yet) or when upstream/X.Y.Z already exists on another commit (--force moves it); it is a no-op when the tag is already right. It prints the git push origin upstream/X.Y.Z command and never pushes.
merge-plan NAME X.Y.Z --repo PATH [--output FILE] [--force] [--allow-stale] [--resolve-expected [--worktree DIR]]
Creates the branch sync/X.Y.Z from dev, tries git merge --no-commit upstream-import/X.Y.Z on it (in a temporary worktree), aborts the merge, and writes a Markdown report (merge-plan-<name>-X.Y.Z.md by default) with:
- the files changed upstream (added/modified/deleted, lines, per area);
- the upstream changes touching files we modified on
dev; - the expected conflicts: "deleted by us" conflicts on
fork_excluded_paths(filesdevintentionally does not carry, such asmicropython-1.12/, the Xcas GUI sources and the autotools build), to be resolved by keeping the deletion; - the excluded additions: files upstream added under
fork_excluded_paths.git mergeadds them todevwithout a conflict (2.1.0 brought back tenmicropython-1.12/files this way), so they are listed apart, to be removed; - the new upstream files outside
fork_excluded_paths: they merge cleanly, but the Meson build may need to list them (2.1.0 addedsrc/proba.ccand its test); - the real conflicts grouped by area: Meson/build, src fixes, docs, other (areas are configured in
upstreams.toml), with their kind ("both modified", "deleted by us", ...).
Like import, it refuses a local dev that differs from origin's unless --allow-stale.
With --resolve-expected, the merge is not aborted: it is left in progress in a worktree of sync/X.Y.Z (default: <repo>-sync-X.Y.Z next to the clone, or --worktree DIR), with the expected conflicts and the excluded additions removed by git rm and the real conflicts still marked. Nothing is committed: finish the merge there, then git worktree remove it.
export NAME --repo PATH [--output FILE]
Lists our changes to the upstream sources, as Markdown: the commits of dev that are not on main and modify the configured source paths (for giac src/ and check/, without meson.build files), oldest first, each with date, hash, subject and GitHub URL (https://github.com/JuliaGiac/giac/commit/<hash>), and the diffstat of main...dev on those paths. This is what the maintainer sends upstream as links.
Exit status
| Status | Meaning |
|---|---|
| 0 | success; for check: every upstream is up to date |
| 1 | error (message on stderr) |
| 10 | check only: a release newer than the latest upstream/X.Y.Z tag exists |