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?
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:Currently there is no option to "force" checkout. You will get a warning
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?
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