From 64348303581816b37b5a7b0b4db2eb5dc0b67478 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Fri, 22 Sep 2017 08:42:51 -0400 Subject: [PATCH] Always resolve branches to a SHA if a tag isn't available The list changes output of I5485b7ea35be76d7c980e7b222b0c3320770493c looks 'messy' as some branches do not resolve to a tag. A shell based example of what the current code does: [tony@thor networking-bgpvpn]$ for branch in $(git branch -a | grep -v -- -\> | tr '[*]' '[ ]') ; do printf "%-30s %s\n" $branch $(git describe --abbrev=0 $branch); done master 7.0.0.0rc1 fatal: No tags can describe '8ff78c308a004cdc948c804190d1178d7263781f'. Try --always, or create some tags. remotes/gerrit/backport/juno fatal: No tags can describe '06aa314936eb9a43d358ed75b2e8fef2dadb59d6'. Try --always, or create some tags. remotes/gerrit/backport/kilo remotes/gerrit/master 7.0.0.0rc1 remotes/gerrit/stable/newton 5.0.0 remotes/gerrit/stable/ocata 6.0.0 remotes/gerrit/stable/pike 7.0.0 fatal: No tags can describe '8ff78c308a004cdc948c804190d1178d7263781f'. Try --always, or create some tags. remotes/origin/backport/juno fatal: No tags can describe '06aa314936eb9a43d358ed75b2e8fef2dadb59d6'. Try --always, or create some tags. remotes/origin/backport/kilo remotes/origin/master 7.0.0.0rc1 remotes/origin/stable/newton 5.0.0 remotes/origin/stable/ocata 6.0.0 remotes/origin/stable/pike 7.0.0 Adding --always: [tony@thor networking-bgpvpn]$ for branch in $(git branch -a | grep -v -- -\> | tr '[*]' '[ ]') ; do printf "%-30s %s\n" $branch $(git describe --always --abbrev=0 $branch); done master 7.0.0.0rc1 remotes/gerrit/backport/juno 8ff78c308a004cdc948c804190d1178d7263781f remotes/gerrit/backport/kilo 06aa314936eb9a43d358ed75b2e8fef2dadb59d6 remotes/gerrit/master 7.0.0.0rc1 remotes/gerrit/stable/newton 5.0.0 remotes/gerrit/stable/ocata 6.0.0 remotes/gerrit/stable/pike 7.0.0 remotes/origin/backport/juno 8ff78c308a004cdc948c804190d1178d7263781f remotes/origin/backport/kilo 06aa314936eb9a43d358ed75b2e8fef2dadb59d6 remotes/origin/master 7.0.0.0rc1 remotes/origin/stable/newton 5.0.0 remotes/origin/stable/ocata 6.0.0 remotes/origin/stable/pike 7.0.0 Change-Id: Ic59797ea2c7e2278e8b25f45511009620e6f103a --- openstack_releases/gitutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack_releases/gitutils.py b/openstack_releases/gitutils.py index 0cd27d20b6..736c830b15 100644 --- a/openstack_releases/gitutils.py +++ b/openstack_releases/gitutils.py @@ -207,7 +207,7 @@ def check_ancestry(workdir, repo, old_version, sha): def get_latest_tag(workdir, repo, sha=None): - cmd = ['git', 'describe', '--abbrev=0'] + cmd = ['git', 'describe', '--abbrev=0', '--always'] if sha is not None: cmd.append(sha) try: