Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

substitute tilde ~ with at @ for git tags #386

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/tito/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ def _get_tag_for_version(self, version_and_release):
'version': version,
'release': release
}
# Strip extra dashes if one of the params is empty
return tag_format.format(**kwargs).strip('-')
# Strip extra dashes if one of the params is empty and replace ~ by @
return tag_format.format(**kwargs).strip('-').replace("~", "@")

def copy_extra_sources(self):
"""
Expand Down
14 changes: 7 additions & 7 deletions src/tito/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def render_cheetah(template_file, destination_directory, cheetah_input):


def tag_exists_locally(tag):
(status, output) = getstatusoutput("git tag | grep %s" % tag)
(status, output) = getstatusoutput("git tag | grep %s" % tag.replace("~", "@"))
if status > 0:
return False
else:
Expand All @@ -423,7 +423,7 @@ def tag_exists_remotely(tag):
def get_local_tag_sha1(tag):
tag_sha1 = run_command(
"git ls-remote ./. --tag %s | awk '{ print $1 ; exit }'"
% tag)
% tag.replace("~", "@"))
tag_sha1 = extract_sha1(tag_sha1)
return tag_sha1

Expand All @@ -438,7 +438,7 @@ def head_points_to_tag(tag):
"""
debug("Checking that HEAD commit is %s" % tag)
head_sha1 = run_command("git rev-list --max-count=1 HEAD")
tag_sha1 = run_command("git rev-list --max-count=1 %s" % tag)
tag_sha1 = run_command("git rev-list --max-count=1 %s" % tag.replace("~", "@"))
debug(" head_sha1 = %s" % head_sha1)
debug(" tag_sha1 = %s" % tag_sha1)
return head_sha1 == tag_sha1
Expand All @@ -455,7 +455,7 @@ def undo_tag(tag):

# Using --merge here as it appears to undo the changes in the commit,
# but preserve any modified files:
output = run_command("git tag -d %s && git reset --merge HEAD^1" % tag)
output = run_command("git tag -d %s && git reset --merge HEAD^1" % tag.replace("~", "@"))
print(output)


Expand Down Expand Up @@ -483,7 +483,7 @@ def get_remote_tag_sha1(tag):
repo_url = get_git_repo_url()
print("Checking for tag [%s] in git repo [%s]" % (tag, repo_url))
cmd = "git ls-remote %s --tag %s | awk '{ print $1 ; exit }'" % \
(repo_url, tag)
(repo_url, tag.replace("~", "@"))
upstream_tag_sha1 = run_command(cmd)
upstream_tag_sha1 = extract_sha1(upstream_tag_sha1)
return upstream_tag_sha1
Expand Down Expand Up @@ -788,7 +788,7 @@ def get_build_commit(tag, test=False):
else:
tag_sha1 = run_command(
"git ls-remote ./. --tag %s | awk '{ print $1 ; exit }'"
% tag)
% tag.replace("~", "@"))
tag_sha1 = extract_sha1(tag_sha1)
commit_id = run_command('git rev-list --max-count=1 %s' % tag_sha1)
return commit_id
Expand All @@ -800,7 +800,7 @@ def get_commit_count(tag, commit_id):
# just the tag.
#
# so we need to pass in the tag as well.
# output = run_command("git describe --match=%s %s" % (tag, commit_id))
# output = run_command("git describe --match=%s %s" % (tag.replace("~", "@"), commit_id))
# if tag == output:
# return 0
# else:
Expand Down
2 changes: 1 addition & 1 deletion src/tito/tagger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def _update_package_metadata(self, new_version):
run_command('git commit -m {0} -m {1} -m {2}'.format(
quote(msg), quote("Created by command:"), quote(" ".join(sys.argv[:]))))

new_tag = self._get_new_tag(new_version)
new_tag = self._get_new_tag(new_version).replace('~', '@')
tag_msg = "Tagging package [%s] version [%s] in directory [%s]." % \
(self.project_name, new_tag,
self.relative_project_dir)
Expand Down
2 changes: 1 addition & 1 deletion src/tito/tagger/susetagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _update_package_metadata(self, new_version):
(self.project_name, new_version_w_suffix,
self.relative_project_dir)

new_tag = self._get_new_tag(new_version)
new_tag = self._get_new_tag(new_version).replace('~', '@')
run_command('git tag -m "%s" %s' % (tag_msg, new_tag))
print
print("Created tag: %s" % new_tag)
Expand Down