Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Hammer
pystencils
Commits
dba69a74
Commit
dba69a74
authored
5 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Fixes when determining version from git tag
- corrected sorting 0.2.10 > 0.2.2
parent
6c1ee87a
Branches
Branches containing commit
Tags
release/0.2.10
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/version_from_git.py
+5
-2
5 additions, 2 deletions
doc/version_from_git.py
release.sh
+2
-2
2 additions, 2 deletions
release.sh
with
7 additions
and
4 deletions
doc/version_from_git.py
+
5
−
2
View file @
dba69a74
import
subprocess
import
subprocess
from
distutils.version
import
StrictVersion
def
version_number_from_git
(
tag_prefix
=
'
release/
'
,
sha_length
=
10
,
version_format
=
"
{version}.dev{commits}+{sha}
"
):
def
version_number_from_git
(
tag_prefix
=
'
release/
'
,
sha_length
=
10
,
version_format
=
"
{version}.dev{commits}+{sha}
"
):
def
get_released_versions
():
def
get_released_versions
():
tags
=
sorted
(
subprocess
.
getoutput
(
'
git tag
'
).
split
(
'
\n
'
))
tags
=
sorted
(
subprocess
.
getoutput
(
'
git tag
'
).
split
(
'
\n
'
))
versions
=
[
t
[
len
(
tag_prefix
):]
for
t
in
tags
if
t
.
startswith
(
tag_prefix
)]
versions
=
[
t
[
len
(
tag_prefix
):]
for
t
in
tags
if
t
.
startswith
(
tag_prefix
)]
...
@@ -15,7 +16,9 @@ def version_number_from_git(tag_prefix='release/', sha_length=10, version_format
...
@@ -15,7 +16,9 @@ def version_number_from_git(tag_prefix='release/', sha_length=10, version_format
parsed_version
[
-
1
]
+=
1
parsed_version
[
-
1
]
+=
1
return
'
.
'
.
join
(
str
(
i
)
for
i
in
parsed_version
)
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
)))
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
]
sha
=
subprocess
.
getoutput
(
'
git rev-parse HEAD
'
)[:
sha_length
]
is_dirty
=
len
(
subprocess
.
getoutput
(
"
git status --untracked-files=no -s
"
))
>
0
is_dirty
=
len
(
subprocess
.
getoutput
(
"
git status --untracked-files=no -s
"
))
>
0
...
...
This diff is collapsed.
Click to expand it.
release.sh
+
2
−
2
View file @
dba69a74
...
@@ -8,6 +8,6 @@ read new_version
...
@@ -8,6 +8,6 @@ read new_version
git tag
-s
release/
${
new_version
}
git tag
-s
release/
${
new_version
}
git push origin master release/
${
new_version
}
git push origin master release/
${
new_version
}
python setup.py sdist bdist_wheel
rm
-rf
dist
rm
-rf
dist
twine upload dist/
*
python setup.py sdist
\ No newline at end of file
twine upload dist/
*
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment