mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 12:14:36 +00:00
Display tags before and after fetch
This commit is contained in:
@@ -28,17 +28,27 @@ def main():
|
||||
# git for-each-ref --format="%(refname:short) | %(creatordate)" "refs/tags/*"
|
||||
local_repo = git.Repo(ROOT)
|
||||
|
||||
print('before:')
|
||||
print(local_repo.git.tag('--list'))
|
||||
|
||||
# Fetch tags since `git fetch' is run with --no-tags during actions/checkout.
|
||||
# git fetch --tags
|
||||
for remote in local_repo.remotes:
|
||||
remote.fetch()
|
||||
|
||||
print('after:')
|
||||
print(local_repo.git.tag('--list'))
|
||||
|
||||
# Sort the tags by version.
|
||||
# git tag --list | sort --reverse --version-sort
|
||||
tags = sorted(
|
||||
local_repo.tags,
|
||||
key=lambda tag: list(map(int, tag.name.split('.'))), reverse=True)
|
||||
|
||||
print('sorted tags:')
|
||||
for tag in tags:
|
||||
print(tag.name)
|
||||
|
||||
most_recent_tag = tags[0]
|
||||
print('most_recent_tag: {}'.format(most_recent_tag))
|
||||
most_recent_tag_datetime = most_recent_tag.commit.committed_datetime
|
||||
|
||||
Reference in New Issue
Block a user