Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
lbmpy
Commits
02255260
Commit
02255260
authored
Feb 22, 2020
by
Martin Bauer
Browse files
Fixes when determining version from git tag
- corrected sorting 0.2.10 > 0.2.2
parent
66cfdd32
Pipeline
#22127
passed with stage
in 19 minutes and 24 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
doc/version_from_git.py
View file @
02255260
import
subprocess
from
distutils.version
import
StrictVersion
def
version_number_from_git
(
tag_prefix
=
'release/'
,
sha_length
=
10
,
version_format
=
"{version}.dev{commits}+{sha}"
):
...
...
@@ -15,7 +16,9 @@ def version_number_from_git(tag_prefix='release/', sha_length=10, version_format
parsed_version
[
-
1
]
+=
1
return
'.'
.
join
(
str
(
i
)
for
i
in
parsed_version
)
latest_release
=
get_released_versions
()[
-
1
]
version_strings
=
get_released_versions
()
version_strings
.
sort
(
key
=
StrictVersion
)
latest_release
=
version_strings
[
-
1
]
commits_since_tag
=
subprocess
.
getoutput
(
'git rev-list {}..HEAD --count'
.
format
(
tag_from_version
(
latest_release
)))
sha
=
subprocess
.
getoutput
(
'git rev-parse HEAD'
)[:
sha_length
]
is_dirty
=
len
(
subprocess
.
getoutput
(
"git status --untracked-files=no -s"
))
>
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment