Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] scipts/combo-layer: Fix check_rev_branch() for cases where the revision is on more than one branch
@ 2012-10-11 11:05 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2012-10-11 11:05 UTC (permalink / raw)
  To: openembedded-core

If a revision is in more than one branch, the check_rev_branch() function can't
cope with it and the tool returns incorrect errror messages. This patch
ensures it copes with this situation.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 3baea24..ae97471 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -283,19 +283,23 @@ def drop_to_shell(workdir=None):
 
 def check_rev_branch(component, repodir, rev, branch):
     try:
-        actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip()
+        actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False)
     except subprocess.CalledProcessError as e:
         if e.returncode == 129:
             actualbranch = ""
         else:
             raise
 
-    if ' ' in actualbranch:
-        actualbranch = actualbranch.split(' ')[-1]
     if not actualbranch:
         logger.error("%s: specified revision %s is invalid!" % (component, rev))
         return False
-    elif actualbranch != branch:
+
+    branches = []
+    branchlist = actualbranch.split("\n")
+    for b in branchlist:
+        branches.append(b.strip().split(' ')[-1])
+
+    if branch not in branches:
         logger.error("%s: specified revision %s is not on specified branch %s!" % (component, rev, branch))
         return False
     return True





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-11 11:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-11 11:05 [PATCH] scipts/combo-layer: Fix check_rev_branch() for cases where the revision is on more than one branch Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox