Description
Records a new commit in the version history. This is the Dolt sense of "commit" and has nothing to do with [DBI::dbCommit()], which ends a SQL transaction; see [doltliter-transactions].
Usage
dolt_commit(
con,
message,
author = NULL,
all = TRUE,
allow_empty = FALSE,
force = FALSE
)
Arguments
con |
a 'DoltliteConnection'. |
message |
the commit message. |
author |
optionally '"Name <email>"', overriding [dolt_config()] for this commit only. |
all |
stage every changed table first, like 'git commit -a' (the default). |
allow_empty |
create a commit even when nothing changed. |
force |
commit despite outstanding constraint violations. |
Details
Inside a 'dbBegin()' block, 'dolt_commit()' leaves the transaction open for you to finish with 'dbCommit()'. The commit is durable either way.
Value
The new commit hash, invisibly.
Examples
con <- DBI::dbConnect(doltliter::Doltlite(), tempfile())
dolt_config(con, user.name = "Ada", user.email = "ada@example.com")
DBI::dbWriteTable(con, "users", data.frame(id = 1:2, nm = c("a", "b")))
dolt_commit(con, "Initial load")
dolt_log(con)$message
#> [1] "Initial load"
#> [2] "Initialize data repository (2cd65cb911bc834245b521220a312da0)"
DBI::dbDisconnect(con)