Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] combo-tool: simply branch/commit validation logic
Date: Mon, 18 Nov 2013 10:42:26 -0700	[thread overview]
Message-ID: <528A5182.2080601@mlbassoc.com> (raw)
In-Reply-To: <1384796370-8899-1-git-send-email-ross.burton@intel.com>

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
------------------------------------------------------------


  reply	other threads:[~2013-11-18 17:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 17:39 [PATCH] combo-tool: simply branch/commit validation logic Ross Burton
2013-11-18 17:42 ` Gary Thomas [this message]
2013-11-18 17:49   ` Burton, Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528A5182.2080601@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox