* [PATCH] combo-tool: simply branch/commit validation logic
@ 2013-11-18 17:39 Ross Burton
2013-11-18 17:42 ` Gary Thomas
0 siblings, 1 reply; 3+ messages in thread
From: Ross Burton @ 2013-11-18 17:39 UTC (permalink / raw)
To: openembedded-core
Simply the branch/revision logic by using git-merge-base.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
scripts/combo-layer | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/scripts/combo-layer b/scripts/combo-layer
index ae97471..2c8ba07 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -283,23 +283,14 @@ 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)
+ mergepoint = runcmd("git merge-base %s %s" % (rev, branch), repodir, printerr=False).rstrip()
except subprocess.CalledProcessError as e:
if e.returncode == 129:
actualbranch = ""
else:
raise
- if not actualbranch:
- logger.error("%s: specified revision %s is invalid!" % (component, rev))
- return False
-
- branches = []
- branchlist = actualbranch.split("\n")
- for b in branchlist:
- branches.append(b.strip().split(' ')[-1])
-
- if branch not in branches:
+ if mergepoint != rev:
logger.error("%s: specified revision %s is not on specified branch %s!" % (component, rev, branch))
return False
return True
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] combo-tool: simply branch/commit validation logic
2013-11-18 17:39 [PATCH] combo-tool: simply branch/commit validation logic Ross Burton
@ 2013-11-18 17:42 ` Gary Thomas
2013-11-18 17:49 ` Burton, Ross
0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2013-11-18 17:42 UTC (permalink / raw)
To: openembedded-core
On 2013-11-18 10:39, Ross Burton wrote:
> Simply the branch/revision logic by using git-merge-base.
Did you mean 'simplify'?
>
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
> scripts/combo-layer | 13 ++-----------
> 1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/combo-layer b/scripts/combo-layer
> index ae97471..2c8ba07 100755
> --- a/scripts/combo-layer
> +++ b/scripts/combo-layer
> @@ -283,23 +283,14 @@ 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)
> + mergepoint = runcmd("git merge-base %s %s" % (rev, branch), repodir, printerr=False).rstrip()
> except subprocess.CalledProcessError as e:
> if e.returncode == 129:
> actualbranch = ""
> else:
> raise
>
> - if not actualbranch:
> - logger.error("%s: specified revision %s is invalid!" % (component, rev))
> - return False
> -
> - branches = []
> - branchlist = actualbranch.split("\n")
> - for b in branchlist:
> - branches.append(b.strip().split(' ')[-1])
> -
> - if branch not in branches:
> + if mergepoint != rev:
> logger.error("%s: specified revision %s is not on specified branch %s!" % (component, rev, branch))
> return False
> return True
>
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-18 17:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18 17:39 [PATCH] combo-tool: simply branch/commit validation logic Ross Burton
2013-11-18 17:42 ` Gary Thomas
2013-11-18 17:49 ` Burton, Ross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.