Git-like version control
A project's versions form a history much like a Git repository's. Each version is a revision with a parent, a published version is frozen like a released commit, and tags are named pointers to a version. Branches, merges and rollbacks build on the same history graph:
main: o---o---o---o (tip)
\
feature: o---o---o (branch tip)
\
merge → new revision (2 parents)
Most of this works today in the web app, the CLI and the API. The branch, merge and rollback controls in the web app are switched off. See Turning on the Git-like controls.
Git concepts in Apiome
| In Git | In Apiome | Where | Available |
|---|---|---|---|
| Commit | A new version (a revision of the project) | New version on Versions; Cut a version | Yes |
| Log, history | The revision graph, its ancestors and the merge base of two revisions | Revision history and merge base (API) | Yes |
| Reflog, audit | Who published, merged, tagged or changed protection | Project activity timeline | Yes |
| Diff | Compare two versions: documents, breaking changes, migration guide | Compare in Version dialogs; Compare published versions (CLI) | Yes |
| Tag | Version tags (stable, prod …), which can be immutable or protected | apiome tags (CLI) and the version tags API; Tag this revision in the web app is switched off | CLI and API |
| Fork | Copy a version into another project, recording where it came from | apiome versions fork and POST /v1/versions/{tenant}/{project}/fork; Fork to another project… in the web app is switched off | CLI and API |
| Release, protect | Publish a version; freeze its schema; unpublish it with a reason | Publish a version, Freeze a version's schema | Yes |
| CI merge gate | Fail a build when a new version breaks the previous one | Version compatibility gate | Yes |
| End of life | Deprecate a version and schedule its sunset | Schedule sunset in Version dialogs; Sunset timeline | Yes |
| Branch | Start a named branch at a revision | Branch from here | Switched off |
| Merge | Preview and apply a merge of two branches, resolving conflicts path by path | Merge branches… | Switched off |
| Feature branch, pull request | Draft on a branch off a version line, get it reviewed, and merge it through a merge session | Draft branches and merge requests: the Merge requests tab and its page | API; the tab is switched off |
| Revert, reset | Move a branch back to an earlier revision | Rollback branch to this revision… | Switched off |
| Branch protection | Lock a revision against deletion | Lock revision (delete policy) | Switched off |
Diffs, merges and rollbacks read stored documents
Comparing two versions, previewing a merge, merging and checking a rollback all need each version's OpenAPI document. Apiome renders a version's document once per change and keeps it in the document store, so these read stored bytes:
- A merge preview reads three stored documents: the merge base and the two branch tips.
- A merge stores the document of the new version as part of the merge, so the first person to open the result does not wait for it.
- A rollback check reads the branch tip and the version you roll back to.
The first read after an edit renders the document again, which takes longer for a large version.
What is not like Git
- No push or pull. A project lives in Apiome, not in a clone. To bring changes in from a Git repository or send them back, use Sources and Sync back to repositories on the Versions page.
- A tag keeps only where it points now. Apiome records who created a tag, not who moved it, so there is no move history.
- A fork copies classes, not paths. Its summary says how many paths the source has.
- A version created on its own is a root. The first version of a project, a New version and an import have no parent, so two such versions have no merge base. See How revisions link.
Turning on the Git-like controls
Flag offFEATURE_GITLIKE
The Branch from here, Merge branches…, Rollback branch to this revision…, Fork to
another project…, Tag this revision and Lock revision (delete policy) controls, and the
Merge requests tab, are built but switched off. FEATURE_GITLIKE is a constant in apiome-ui/lib/feature-flags.ts, false in
every shipped build. Turning them on takes a code change and a rebuild. Version
dialogs lists each control and what it does.
The CLI and the API don't depend on this switch: forking, tagging, draft branches and merge requests work there today.
Related
- Versions: the timeline, its tabs and the CLI and API.
- Version dialogs: every dialog, including the Git-like controls.
- Draft branches and merge requests: branch, review and merge without Git.
- Revision history and merge base
- Project activity timeline
- Publish a version
- Version compatibility gate
- CLI:
versions,tags