[Asterisk-code-review] testsuite: Check origin branch, not local branch. (repotools[master])

Joshua Colp asteriskteam at digium.com
Wed May 2 11:44:03 CDT 2018


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/8909


Change subject: testsuite: Check origin branch, not local branch.
......................................................................

testsuite: Check origin branch, not local branch.

When creating a new branch we can't assume that a local
branch will already exist. We have to check that it exists
in the origin remote. The act of checking it out will then
create a local branch.

Change-Id: I9cc8d3c1fc52c76cf93351480f4b460a70ba625e
---
M digium_git.py
M testsuite.py
2 files changed, 14 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/repotools refs/changes/09/8909/1

diff --git a/digium_git.py b/digium_git.py
index 7cd7c1e..0512642 100644
--- a/digium_git.py
+++ b/digium_git.py
@@ -249,6 +249,19 @@
 
         return name in self.repo.heads
 
+    def origin_branch_exists(self, name):
+        """Determine if a branch exists on the origin
+
+        Keyword Arguments:
+        name - The name of the branch to look for
+
+        Returns:
+        True if the branch exists
+        False if the branch does not
+        """
+
+        return name in self.repo.remotes.origin.refs
+
     def _push_updated_branches(self):
         """Push new or updated branches to the remote repository."""
 
diff --git a/testsuite.py b/testsuite.py
index e60e24a..0724dcb 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -130,7 +130,7 @@
             # tag(s) should already exist.
             base = version.branch_name(prefix=False)
 
-            if not self.branch_exists(base):
+            if not self.origin_branch_exists(base):
                 # If for some reason the base branch doesn't exist (release
                 # branch was deleted prior to creating the prefixed branch)
                 # then use the latest tag instead.

-- 
To view, visit https://gerrit.asterisk.org/8909
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cc8d3c1fc52c76cf93351480f4b460a70ba625e
Gerrit-Change-Number: 8909
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180502/61cb33f6/attachment.html>


More information about the asterisk-code-review mailing list