Skip to content

Support bumping local version #302

Closed
@marcossantiago

Description

@marcossantiago

Description

I am working on some projects where the version is a combination of the a public api version + our local version.

Example: 5.3.1+1.0.0.

So when we bump we actually wants to bump only the local version like 5.3.1+1.0.0 -> 5.3.1+1.1.0, but cz completely ignores the local version and only bumps the first release like:

➜ cz bump --files-only --yes
bump: version 5.3.1+0.9.0 → 5.4.0

This does seems like would be a breaking change though...

Possible Solution

A possible solution would be to modify the semver_generator() to check if the local version complies with semver and bump the local version instead. The method would return the entire version like 5.3.1+1.1.0.

>>> from packaging.version import Version
>>> a = Version("5.3.1+1.0.0")
>>> a.base_version
'5.3.1'
>>> a.local
'1.0.0'
>>> b.base_version
'1.0.0'
>>> b.release
(1, 0, 0)

If you accept, I will be happy to create a PR with the changes.

Additional context

References: Python 440 Local version

Activity

woile

woile commented on Nov 12, 2020

@woile
Member

Seems related to #150
It doesn't necessarily have to be a breaking change, what if a flag is used --local-version? would it be breaking?
If you want you can share a PR and we can discuss it there.

marcossantiago

marcossantiago commented on Nov 12, 2020

@marcossantiago
ContributorAuthor

That would be great. I will create a PR passing the flag --local-version, once you're okay I will also commit the tests.

marcossantiago

marcossantiago commented on Nov 12, 2020

@marcossantiago
ContributorAuthor

@woile PR created :)

woile

woile commented on Nov 14, 2020

@woile
Member

Released on 2.7.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @marcossantiago@woile

        Issue actions

          Support bumping local version · Issue #302 · commitizen-tools/commitizen