[bob-build-tool] Re: Howto query for source dirs on switched branch

  • From: Thomas Feher <thomas.feher@xxxxxxxxxxxxxxxxxxxx>
  • To: bob-build-tool@xxxxxxxxxxxxx
  • Date: Fri, 21 Oct 2016 08:59:34 +0200

Hi,

such a feature is very interesting for us, too. At the moment we do have a script, that goes 
through each "workspace" directory in dev/src und performs a "git status". This 
way we can check if the working copy is in a dirty state or not. But we can not check if the 
correct revision is checked out, because that information is hidden in the recipes, and we do not 
want to re-implement parsing them, of course.

So I would like to see something like "bob status <recipe>" that shows me, 
which repository has the wrong revision checked out, so I can change those to my liking. But I 
see the problem that this could be hard to make SCM-agnostic.

Tom

On 10/20/2016 08:48 PM, Jan Klötzke wrote:

On Thu, Oct 20, 2016 at 07:53:01PM +0200, Ralf wrote:
> Thank's for the script. Good idea to combine query scm and query path. I'll
> test this tomorrow.
>
> What about the force-checkout? Do you think this can be a usefull feature?

It's certainly a useful feature. But I'm not sure how to implement it at
the moment, though. Internally Bob tracks for each SCM directory what
_should_ be checked out. Unless the recipe is changed Bob will consider
the directory ok. The git SCM then has some logic in the generated
checkout script to prevent the "git
pull" if some other branch is checked out.

An idea could be to extend the SCMs to check if the directory is sane
and, if not, move the affected directory into the attic. That would
imply to call git/svn/... directly from Bob. Currently the SCMs only
generate scripts...

>
> On 20.10.2016 15:02, Jan Klötzke wrote:
>> On Tue, Oct 18, 2016 at 09:24:42PM +0200, Ralf wrote:
>>> imagine the following situation:
>>>
>>> 1) bob dev myApp
>>> 2) cd dev/src/myLib/1/workspace && git checkout -b myFeatureBranch
>>> 3) write code, commit and push
>>> 4) get interrupted, do some other work and forget about 3
>>>
>>> How can I use bob to reset all src directories to the branch / tag or
>>> whatever is specified in the recipe? Or how can I query for source
>>> directories using a different branch?
>> Currently there is no option to "force" checkout. You will get a warning
>> if the checkout step encounters the wrong branch in the local working
>> copy, though.
>>
>> But there is some way to get all git checkouts with their configured
>> branches. You can use this to check if this branch is really checked
>> out. Something along the following lines should work:
>>
>>    #!/bin/bash
>>    bob query-scm -r -f git="git {package} {dir} {branch}" $1 | \
>>    grep "^git" | \
>>    while read _git package dir branch ; do
>>      base="$(bob query-path -f "{src}" $package)"
>>      [[ -n $base ]] || continue
>>      current="$(git -C $base/$dir symbolic-ref --short HEAD)"
>>      if [[ $current != $branch ]] ; then
>>        echo "$base/$dir: branch '$current' checked out but '$branch' is 
configured"
>>      fi
>>    done
>>
>> This can certainly be optimized but it should find those switched
>> branches...
>>
>> Regards,
>> Jan
>>
>
>
>

--

Dr.-Ing. Thomas Fehér

voiceINTERconnect GmbH
Ammonstr. 35
01067 Dresden
Germany

mail: thomas.feher@xxxxxxxxxxxxxxxxxxxx
phone: +49 - 351 - 407 526 596
fax: +49 - 351 - 407 526 55



Geschäftsführung:
Dr.-Ing. Diane Hirschfeld, Ludwig Linkenheil

Eingetragen im Handelsregister:
Amtsgericht Dresden HRB 19466

--------------------------------------------------
www.voiceinterconnect.de

... smart signal processing for electronic devices


Other related posts: