Skip to content

Commit

Permalink
[jsk_robot_startup] use rev-list to check diverge
Browse files Browse the repository at this point in the history
  • Loading branch information
mqcmd196 committed Jul 13, 2023
1 parent 1c61c3f commit 8b5ee72
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if [ "${UPDATE_WORKSPACE}" == "true" ]; then
ln -sf $ROSINSTALL $WORKSPACE/src/.rosinstall
wstool update -t $WORKSPACE/src --delete-changed-uris
# When the repository's Spec-Version branch has commits which are not pushed to remote, they are evacuated to another branch
wstool foreach -t $WORKSPACE/src --git --shell 'expected_version=$(wstool info . | grep Spec-Version: | awk '\''{print $2}'\''); current_version=$(git rev-parse --abbrev-ref HEAD); remote_diff=$(git diff --stat $current_version origin/$current_version); if [ "$expected_version" = "$current_version" ] && [ -n "$remote_diff" ]; then git checkout -b ${expected_version}-patch-$(date +%Y%m%d%H%M%S); git checkout origin/$expected_version; git branch -D $expected_version; git checkout -b $expected_version --track origin/$expected_version; fi'
wstool foreach -t $WORKSPACE/src --git --shell 'expected_version=$(wstool info . | grep Spec-Version: | awk '\''{print $2}'\''); current_version=$(git rev-parse --abbrev-ref HEAD); remote_diff_head_origin=$(git rev-list HEAD..origin); remote_diff_origin_head=$(git rev-list origin..HEAD); remote_diff="${remote_diff_head_origin}${remote_diff_origin_head}"; if [ "$expected_version" = "$current_version" ] && [ -n "$remote_diff" ]; then git checkout -b ${expected_version}-patch-$(date +%Y%m%d%H%M%S); git checkout origin/$expected_version; git branch -D $expected_version; git checkout -b $expected_version --track origin/$expected_version; fi'

This comment has been minimized.

Copy link
@sktometometo

sktometometo Jul 13, 2023

Contributor

Looks almost good!. There is one point to change.

We would like to check rev-list from current HEAD to desired branch in origin, but with this case, origin sometimes stands for another branch, (e.g. it stands for origin/master at jsk_robot, not develop/fetch)

So it would be nice to use origin/$(expected_version) instead of origin.

wstool update -t $WORKSPACE/src
WSTOOL_UPDATE_RESULT=$?
else
Expand Down

0 comments on commit 8b5ee72

Please sign in to comment.