[PATCH kteam-tools] verify-release-ready: support other remotes than origin

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Thu Jun 29 15:55:56 UTC 2017


If the current branch uses a remote other than origin, check the tag is
pushed in that remote instead of origin. As more branches are kept in
their own repo these days, this allows one to use a single local repo
for those.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
---
 ktl/git.py                        | 12 ++++++++++++
 maintscripts/verify-release-ready |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ktl/git.py b/ktl/git.py
index 9e5cc72b..5c4e270e 100644
--- a/ktl/git.py
+++ b/ktl/git.py
@@ -100,6 +100,18 @@ class Git:
             raise GitError("no current branch")
         return result[0].replace("refs/heads/", "")
 
+    # remote
+    #
+    # Return a string that is the remote this branch tracks or origin.
+    #
+    @classmethod
+    def remote(cls):
+        branch = cls.current_branch()
+        status, result = run_command("git config branch.%s.remote" % branch, cls.debug)
+        if status != 0:
+            return "origin"
+        return result[0]
+
     # show
     #
     @classmethod
diff --git a/maintscripts/verify-release-ready b/maintscripts/verify-release-ready
index b22c5aa4..7805b462 100755
--- a/maintscripts/verify-release-ready
+++ b/maintscripts/verify-release-ready
@@ -312,7 +312,8 @@ class VerifyReleaseReady():
         else:
             # Verify tag has been pushed!
             msg = 'tag pushed'
-            status, result = run_command("git ls-remote --tags origin %s" % expected)
+            branch = Git.remote()
+            status, result = run_command("git ls-remote --tags %s %s" % (branch, expected))
             if status == 0 and expected in result[0]:
                 s.status(msg, True)
             else:
-- 
2.11.0





More information about the kernel-team mailing list