Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop/fetch] [jsk_robot_startup] Work around update_workspace #1824

Open
wants to merge 430 commits into
base: develop/fetch
Choose a base branch
from

Conversation

mqcmd196
Copy link
Member

@mqcmd196 mqcmd196 commented Jun 21, 2023

Background

  1. Untracked files are not stashed
  2. The script assumes that jsk_robot is in src/jsk-ros-pkg/jsk_robot
  3. If you accidentally leave only local commits within the robot body on a branch configured for rosinstall, such as develop/fetch, the changes will disappear.

What has been changed?

  1. git stash -u instead
  2. execute wstool update -t $WORKSPACE/src $(rospack find jsk_robot_startup)/../.. --delete-changed-uris instead of wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot --delete-changed-uris
  3. If some commits in the branch configured for rosinstall were found, the script evacuates those commits to another branch, like develop/fetch-patch-${current date}

@mqcmd196 mqcmd196 changed the title Pr/fix update ws [develop/fetch] [jsk_robot_startup] Work around update_workspace Jun 22, 2023
@mqcmd196 mqcmd196 marked this pull request as ready for review June 22, 2023 01:27
@mqcmd196
Copy link
Member Author

mqcmd196 commented Jun 22, 2023

rebased current origin/develop/fetch and checked work correctly

JSK fetch user and others added 21 commits June 26, 2023 12:58
sktometometo and others added 2 commits June 27, 2023 17:16
* [jsk_fetch_startup] add write-message-on-message-board to
navigation-utils.l

* [jsk_fetch_startup] Use write-message-on-message-board in kitchen-demo

* Update jsk_fetch_robot/jsk_fetch_startup/euslisp/navigation-utils.l

add package existence check for esp_now_ros

Co-authored-by: Naoto Tsukamoto <[email protected]>

* [jsk_fetch_startup] publish dummy packet before write message on message board

* Add more message and debug output

* [jsk_fetch_startup] fix error

* [jsk_fetch_starup] get rid of dummy message writing

* [jsk_fetch_startup] Change enr_message_board address

---------

Co-authored-by: Naoto Tsukamoto <[email protected]>
@sktometometo
Copy link
Contributor

@mqcmd196 kindly ping, I would appreciate any comments on the progress of this Pull Request and previous discussions.

@mqcmd196
Copy link
Member Author

@sktometometo
Sorry for late, please check 8b5ee72

@mqcmd196
Copy link
Member Author

I have to check on real robot

# Forcefully checkout specified branch
wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi'
# 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_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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

# Forcefully checkout specified branch
wstool foreach -t $WORKSPACE/src --git --shell 'branchname=$(git rev-parse --abbrev-ref HEAD); if [ $branchname != "HEAD" ]; then git reset --hard HEAD; git checkout origin/$branchname; git branch -D $branchname; git checkout -b $branchname --track origin/$branchname; fi'
# 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_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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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'
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/$expected_version); remote_diff_origin_head=$(git rev-list origin/$expected_version..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'

@sktometometo
Copy link
Contributor

Let's merge and check with a robot.

@mqcmd196
Copy link
Member Author

After tomorrow, I'll go to the lab and check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.