mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix a versions' tweak for tagged commits, improve version_helper
This commit is contained in:
parent
c15e7b93cb
commit
07203a4542
@ -171,7 +171,16 @@ class Git:
|
||||
if not self.latest_tag.endswith("-testing"):
|
||||
# When we are on the tag, we still need to have tweak=1 to not
|
||||
# break cmake with versions like 12.13.14.0
|
||||
return self.commits_since_tag or TWEAK
|
||||
if not self.commits_since_tag:
|
||||
# We are in a tagged commit. The tweak should match the
|
||||
# current version's value
|
||||
version = self.latest_tag.split("-", maxsplit=1)[0]
|
||||
try:
|
||||
return int(version.split(".")[-1])
|
||||
except ValueError:
|
||||
# There are no tags, or a wrong tag. Return default
|
||||
return TWEAK
|
||||
return self.commits_since_tag
|
||||
|
||||
version = self.latest_tag.split("-", maxsplit=1)[0]
|
||||
return int(version.split(".")[-1]) + self.commits_since_tag
|
||||
|
@ -335,6 +335,7 @@ def main():
|
||||
"--version-type",
|
||||
"-t",
|
||||
choices=VersionType.VALID,
|
||||
default=VersionType.TESTING,
|
||||
help="optional parameter to generate DESCRIBE",
|
||||
)
|
||||
parser.add_argument(
|
||||
@ -344,10 +345,16 @@ def main():
|
||||
help="if the ENV variables should be exported",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update",
|
||||
"-u",
|
||||
"--update-part",
|
||||
choices=("major", "minor", "patch"),
|
||||
help="the version part to update, tweak is always calculated from commits",
|
||||
help="the version part to update, tweak is always calculated from commits, "
|
||||
"implies `--update-cmake`",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update-cmake",
|
||||
"-u",
|
||||
action="store_true",
|
||||
help=f"is update for {FILE_WITH_VERSION_PATH} is needed or not",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update-contributors",
|
||||
@ -364,13 +371,12 @@ def main():
|
||||
|
||||
version = get_version_from_repo(args.version_path, Git(True))
|
||||
|
||||
if args.update:
|
||||
version = version.update(args.update)
|
||||
if args.update_part:
|
||||
version = version.update(args.update_part)
|
||||
|
||||
if args.version_type:
|
||||
version.with_description(args.version_type)
|
||||
version.with_description(args.version_type)
|
||||
|
||||
if args.update:
|
||||
if args.update_part or args.update_cmake:
|
||||
update_cmake_version(version)
|
||||
|
||||
for k, v in version.as_dict().items():
|
||||
|
Loading…
Reference in New Issue
Block a user