diff --git a/bob/devtools/release.py b/bob/devtools/release.py index 5858bf55f3239c6e2e3063a4e2facd441fba317d..a26b04a6e5ffe2f84121159377dc2ff2703f79b4 100644 --- a/bob/devtools/release.py +++ b/bob/devtools/release.py @@ -153,14 +153,25 @@ def get_parsed_tag(gitpkg, tag): # if we bump the version, we need to find the latest released version for # this package - if 'patch' == tag or 'minor' == tag or 'major' == tag: + if tag in ('major', 'minor', 'patch'): # find the correct latest tag of this package (without 'v' in front), # None if there are no tags yet latest_tag_name = get_latest_tag_name(gitpkg) # if there were no tags yet, assume the very first version - if not latest_tag_name: return 'v0.0.1' + if latest_tag_name is None: + if tag == 'major': + assume_version = 'v1.0.0' + elif tag == 'minor': + assume_version = 'v0.1.0' + elif tag == 'path': + assume_version = 'v0.0.1' + logger.warn('Package %s does not have any tags. I\'m assuming ' \ + 'version will be %s since you proposed a "%s" bump', + gitpkg.attributes['path_with_namespace'], assume_version, + tag) + return assume_version # check that it has expected format #.#.# # latest_tag_name = Version(latest_tag_name) diff --git a/doc/release.rst b/doc/release.rst index e83da16fe4bc30f1fe551f40587962ea07d2f580..60d3e9cca3b55cae945a1958edb0f907370af48d 100644 --- a/doc/release.rst +++ b/doc/release.rst @@ -58,7 +58,9 @@ To manually update the changelog, follow these guidelines: version of this package will be automatically updated during the next tag/release. You can change ``patch`` to ``minor`` or ``major``, and the package will be then tagged/released with either minor or major version - bump. + bump. You may also set an explicit tag to the package (e.g. + ``v1.0.0``), which may be required if no tags are available yet on + gitlab. 3. Once all commits were changed to corresponding tag descriptions (no more lines start with ``-`` characters), this package is ready for release and you can continue to another package in the changelog.