Undoes bumping the package version
Source:R/api-unbump-version.R
, R/unbump-version.R
unbump_version.Rd
This undoes the effect of a bump_version()
call, with a safety check.
Examples
# Create mock package in a temporary directory.
# Set open to TRUE if you want to play in the mock package.
with_demo_project({
# Use functions as if inside the newly created package project.
# (Or go and actually run code inside the newly created package project!)
# Add a new R file.
usethis::use_r("cool-function", open = FALSE)
# Pretend we added useful code inside it.
# Track the new R file with Git.
gert::git_add("R/cool-function.R")
gert::git_commit("- Add cool function.")
# Bump version with fledge.
fledge::bump_version()
# Oh no, we forgot to also add the awesome function for that version!
# UNBUMP
fledge::unbump_version()
# Add a new R file.
usethis::use_r("awesome-function", open = FALSE)
# Pretend we added awesome code inside it.
# Track the new R file with Git.
gert::git_add("R/awesome-function.R")
gert::git_commit("- Add awesome function.")
# Bump version with fledge.
fledge::bump_version()
#'
})
#> ✔ Setting active project to "/tmp/Rtmpkg8Mba/fledge484d5ee6f75d/tea".
#> ☐ Edit R/cool-function.R.
#> → Digesting messages from 3 commits.
#> ✔ Found 1 NEWS-worthy entry.
#>
#> ── Updating NEWS ──
#>
#> → Adding new entries to NEWS.md.
#>
#> ── Updating Version ──
#>
#> ✔ Package version bumped to 0.0.0.9001.
#> → Added header to NEWS.md.
#> → Committing changes.
#>
#> ── Tagging Version ──
#>
#> → Creating tag v0.0.0.9001 with tag message derived from NEWS.md.
#> ! Run `fledge::finalize_version()`.
#> ℹ Checking if working copy is clean.
#> ℹ Checking if last tag points to last commit.
#> ℹ Checking if commit messages match.
#> ✔ Safety checks complete.
#> → Deleting tag v0.0.0.9001.
#> ✔ Resetting to parent commit 42.
#> ☐ Edit R/awesome-function.R.
#> → Digesting messages from 4 commits.
#> ✔ Found 2 NEWS-worthy entries.
#>
#> ── Updating NEWS ──
#>
#> → Adding new entries to NEWS.md.
#>
#> ── Updating Version ──
#>
#> ✔ Package version bumped to 0.0.0.9001.
#> → Added header to NEWS.md.
#> → Committing changes.
#>
#> ── Tagging Version ──
#>
#> → Creating tag v0.0.0.9001 with tag message derived from NEWS.md.
#> ! Run `fledge::finalize_version()`.
#> ✔ Setting active project to "<no active project>".