Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "auto" version modifier #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ian-fox
Copy link

@ian-fox ian-fox commented Sep 24, 2020

This adds another possible value for the version argument: "auto"

If somebody runs cargo bump auto, it will look at their most recent commit message. If that message contains the string [major], it performs a major bump. Similarly for [minor], and if neither is found it defaults to [patch].

Example:

$ grep 'version =' Cargo.toml'
version = "1.1.0"
$ git log -1
commit 86bfa1bf8b70c4ce3a58ae47458d9d2c8d58b279 (HEAD -> auto)
Author: Ian Fox <[email protected]>
Date:   Wed Sep 23 23:11:27 2020 -0400

    [minor] add 'auto' version modifier
$ cargo bump auto
$ grep 'version =' Cargo.toml'
version = "1.2.0"

Did manual testing but didn't add a unit test as it would have meant a bunch of effort to mock the output of the process::Command and that wasn't there for the other git commands.

Also bumped the version of toml_edit becuase it wasn't compiling for me on 0.1.3, removed a .clone() which rustc told me was unnecessary, and renamed the functions in the git module to avoid stutter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant