c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.06k stars 134 forks source link

How to keep the metadata part when bumping version? #80

Open martinm82 opened 5 years ago

martinm82 commented 5 years ago

Hello,

I have reported already the same question on the original project but then found this one which seems to be actively maintained.

We are using semantic versioning (semver.org) in our projects and stumbled upon the following problem:

We have some projects that extend some other upstream projects with some functionality (eg. forks). We want to version our projects with the following semver schema:

1.2.3+4.2.1
1.2.3-SNAPSHOT+4.2.1

where 1.2.3 is our own version of the project and 4.2.1, the metadata part of semver, which reflects the upstream version our changes are based on.

When releasing our versions we would like to have the following flow:

# current_version=1.2.3-SNAPSHOT+4.2.1
$ bumpversion release
# current_version=1.2.3+4.2.1
$ bumpversion patch
# current_version=1.2.4-SNAPSHOT+4.2.1

Right now we use the following configuration:

parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-zA-Z]+))?
serialize =
  {major}.{minor}.{patch}-{release}
  {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = rel
values =
  dev
  rel

Is it possible to implement this kind of workflow where the metadata part (eg. +4.2.1) won't be touched? I have tried various things but did not come up with something that just leaves the metadata part. Also it would be great to have one config that covers the case with +metadata and without it.

Thanks a lot.

florisla commented 4 years ago

Note: ADVbumpversion implemented this as a new option in the part config called independent. See https://github.com/andrivet/ADVbumpversion.

The only workaround I know is to supply the metadata as an environment variable.

I think the independent flag is cleaner so I'd consider that a good feature to support.

c4urself commented 4 years ago

I like the independent flag -- on that note it may be a good idea to reach out to @andrivet and see if incorporating that will allow all use-cases supported by the fork to be supported by us so that we can cease the fork...

andrivet commented 4 years ago

Can I help for something to help going on with this "issue"?