Provides a functional api to make commits. It is centered around the concept of a changeset.
A changeset is an object that accumulates a series of changes to the repository that will eventually generate a commit.
A changeset can be created by calling from-revision
or from-branch!
.
A changeset can be "changed" by using put-content
, update-content
, delete
, etc. Those functions don't actually
change the changeset but return a new one.
get-content
will return the content of a file correspondent to the state of the provided changeset.
Once the necessary changes have been made, commit!
will generate a commit having the changeset base revision as its parent.
commit!
will not update the head of the branch, but create-branch!
and update-branch!
can be used to do that.
That allows one to make a series of commits and only change the branch when they are ready to, which makes it easier
to make processes idempontent, since if anything wrong happens the intermediary commits can just be ignored.
Note: The internal format of the changeset is considered an implementation detail and should not be relied upon.
Always create a changeset using one of the factory functions (e.g. from-revision
, from-branch
).
Provides a functional api to make commits. It is centered around the concept of a changeset. A changeset is an object that accumulates a series of changes to the repository that will eventually generate a commit. A changeset can be created by calling `from-revision` or `from-branch!`. A changeset can be "changed" by using `put-content`, `update-content`, `delete`, etc. Those functions don't actually change the changeset but return a new one. `get-content` will return the content of a file correspondent to the state of the provided changeset. Once the necessary changes have been made, `commit!` will generate a commit having the changeset base revision as its parent. `commit!` will not update the head of the branch, but `create-branch!` and `update-branch!` can be used to do that. That allows one to make a series of commits and only change the branch when they are ready to, which makes it easier to make processes idempontent, since if anything wrong happens the intermediary commits can just be ignored. Note: The internal format of the changeset is considered an implementation detail and should not be relied upon. Always create a changeset using one of the factory functions (e.g. `from-revision`, `from-branch`).
(commit! {:keys [client org repo base-revision changes] :as changeset} message)
Commits the changeset returning a new changeset based on the new commit revision. If the changeset does not contain any changes, calling this function is a no-op. This function does not update the HEAD of a branch.
Commits the changeset returning a new changeset based on the new commit revision. If the changeset does not contain any changes, calling this function is a no-op. This function does not update the HEAD of a branch.
(create-branch! {:keys [client org repo base-revision] :as changeset} branch)
Creates a branch that points to the base revision of the given changeset. Returns a new changeset with the branch associated.
The changeset should not contain any changes.
Creates a branch that points to the base revision of the given changeset. Returns a new changeset with the branch associated. The changeset should not contain any changes.
(delete revision path)
Returns a new changeset with the file under path deleted.
Returns a new changeset with the file under path deleted.
(delete-branch! {:keys [client org repo branch] :as changeset})
Deletes the branch associated with the changeset, returning the changeset with the branch excluded.
The changeset should not contain any changes.
Deletes the branch associated with the changeset, returning the changeset with the branch excluded. The changeset should not contain any changes.
(dirty? {:keys [changes]})
Returns true if changes were made to the given changeset
Returns true if changes were made to the given changeset
(from-branch! client org repo branch)
Creates a new changeset based on the current HEAD of a given branch.
Creates a new changeset based on the current HEAD of a given branch.
(from-revision client org repo revision)
Creates a new changeset based on a given git revision (hexadecimal sha).
Creates a new changeset based on a given git revision (hexadecimal sha).
(get-content {:keys [client org repo base-revision changes]} path)
Returns the content of a file (as a string) for a given changeset.
Returns the content of a file (as a string) for a given changeset.
(put-content changeset path content)
Returns a new changeset with the file under path with new content.
content
must be a string (only text files are supported).
It creates a new file if it does not exist yet.
Returns a new changeset with the file under path with new content. `content` must be a string (only text files are supported). It creates a new file if it does not exist yet.
(update-branch! {:keys [client org repo base-revision branch] :as changeset})
Updates a branch to point to the base revision of the given changeset. Returns the changeset unchanged.
The changeset should not contain any changes.
Updates a branch to point to the base revision of the given changeset. Returns the changeset unchanged. The changeset should not contain any changes.
(update-content revision path update-fn)
Returns a new changeset with the file under path with new content return by update-fn
.
update-fn
should be an 1-arg function that receives the current content of the file.
Returns a new changeset with the file under path with new content return by `update-fn`. `update-fn` should be an 1-arg function that receives the current content of the file.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close