git-aggregator and doodba#
odx reads and writes the files of
git-aggregator (repos.yaml) and
doodba (addons.yaml), so existing
projects can move over gradually.
Switching a project over#
Import. In the directory with
repos.yaml:$ odx import repos.yaml --writeThis writes
[[tool.odx.repositories]]intopyproject.toml(created when missing) and reports on standard error what it could not translate, such asshell_command_after.Build and compare.
odx aggregatebuilds the same repositories undervendor/<name>, or wheretarget_dirsays. The trees are identical to whatgitaggregatebuilds; only the commit ids differ, because odx rebases the merges by default (merge_strategy = "merge"creates merge commits asgitaggregatedoes). To compare, build both and rungit diff --stat <gitaggregate dir> <odx dir>over the addon directories, or comparegit rev-parse HEAD^{tree}of each.Lock.
odx lock, then commitpyproject.tomlandodx.lock. From here on the build is reproducible, whichgitaggregatewas not.Replace the calls. Where scripts or CI ran
gitaggregate -c repos.yaml, runodx aggregate --locked. If something still readsrepos.yaml, keep it generated withodx exportuntil it is gone, or useodx git-aggregate, which runs arepos.yamlunchanged.Remove
repos.yamlonce nothing reads it.[tool.odx]is the only source from then on.
doodba’s addons.yaml is imported along with repos.yaml when it sits next
to it: its addon lists become addons = [...] on the repositories.
Import#
$ odx import # repos.yaml (+ addons.yaml next to it)
$ odx import repos.yaml addons.yaml
prints the equivalent [[tool.odx.repositories]] tables:
repos.yaml |
|
|---|---|
target directory key ( |
|
first merge ( |
|
|
|
a commit ( |
|
a branch on the same remote |
|
a branch on another remote |
|
|
|
|
accepted and ignored (odx fetches into a shared object cache) |
|
not imported (warning) |
addons.yaml |
|
addons.yaml documents with |
skipped (warning) |
Everything that cannot be represented is reported as a warning on standard
error. odx import --write adds the repositories to pyproject.toml instead
of printing them, skipping URLs that are already configured. A directory
without a pyproject.toml, as a git-aggregator project usually is, gets one
with a [project] table named after the directory. When the file has no
[tool.odx] table yet, it is created with --odoo-version or the first base
branch as the series.
Export#
$ odx export # writes repos.yaml and addons.yaml in the project root
$ odx export --stdout
writes the files back from [tool.odx], deterministically and with a header
marking them as generated. The repository URL becomes remote origin;
branches from other URLs get a remote named after the URL’s owner. GitLab
repositories use refs/merge-requests/N/head. Exporting and importing again
yields the same repositories, merges, targets and addon lists.
gitaggregate drop-in#
$ odx git-aggregate -c repos.yaml # or the standalone git-aggregate-rs
$ odx git-aggregate -c repos.yaml -d '*/sale-*' -j 8
$ odx git-aggregate -c repos.yaml -e --env-file .env -p
odx git-aggregate (and the git-aggregate-rs package) runs a repos.yaml
the way gitaggregate does, on the odx engine: every remote is fetched once
into the shared cache, concurrently, and each target directory becomes a
working tree of that cache with the merges applied in order. Target
directories are relative to the current directory, as with gitaggregate.
Option |
Effect |
|---|---|
|
the |
|
only target directories matching the fnmatch pattern |
|
expand |
|
|
|
discard local changes; replace directories odx did not create |
|
push the result to |
|
repositories at once (default: number of CPUs) |
|
|
|
rebase the merges instead of creating merge commits |
|
run |
|
resolve conflicts with mergiraf ( |
|
summary on stdout (schema 1) |
Differences from gitaggregate:
Target directories are detached working trees of the cache:
git log,git diffandgit statuswork, but the remotes are not configured in them and the target branch only exists on the push remote.Directories created by
gitaggregateare replaced only with-f.Every merge is a merge commit, as with
gitaggregate, but never a fast-forward, so commit ids differ;--rebaserebases the merges instead, for a linear history. Either way the resulting trees are identical, which CI checks against git-aggregator 4.1.With
-e, an unset variable is left as written with a warning.show-closed-prsandshow-all-prsprint git-aggregator’s<url> in state <state> (merged|not merged)lines on standard output for everyrefs/pull/<n>/head(or GitLabrefs/merge-requests/<n>/head) merge, on GitHub, GitLab and Gitea/Forgejo alike; a pull request odx cannot read is a warning, not a failure.
The cache and local clones are shared with odx aggregate (see
Building the workspace).