Skip to main content

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 GitIn ApiomeWhereAvailable
CommitA new version (a revision of the project)New version on Versions; Cut a versionYes
Log, historyThe revision graph, its ancestors and the merge base of two revisionsRevision history and merge base (API)Yes
Reflog, auditWho published, merged, tagged or changed protectionProject activity timelineYes
DiffCompare two versions: documents, breaking changes, migration guideCompare in Version dialogs; Compare published versions (CLI)Yes
TagVersion tags (stable, prod …), which can be immutable or protectedapiome tags (CLI) and the version tags API; Tag this revision in the web app is switched offCLI and API
ForkCopy a version into another project, recording where it came fromapiome versions fork and POST /v1/versions/{tenant}/{project}/fork; Fork to another project… in the web app is switched offCLI and API
Release, protectPublish a version; freeze its schema; unpublish it with a reasonPublish a version, Freeze a version's schemaYes
CI merge gateFail a build when a new version breaks the previous oneVersion compatibility gateYes
End of lifeDeprecate a version and schedule its sunsetSchedule sunset in Version dialogs; Sunset timelineYes
BranchStart a named branch at a revisionBranch from hereSwitched off
MergePreview and apply a merge of two branches, resolving conflicts path by pathMerge branches…Switched off
Feature branch, pull requestDraft on a branch off a version line, get it reviewed, and merge it through a merge sessionDraft branches and merge requests: the Merge requests tab and its pageAPI; the tab is switched off
Revert, resetMove a branch back to an earlier revisionRollback branch to this revision…Switched off
Branch protectionLock a revision against deletionLock 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.