diff --git a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh
index 053f0fcfd3..d22e9b7265 100755
--- a/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh
+++ b/jsk_robot_common/jsk_robot_startup/scripts/update_workspace_main.sh
@@ -82,13 +82,26 @@ set -x
wstool foreach -t $WORKSPACE/src --git 'git stash'
wstool foreach -t $WORKSPACE/src --git 'git fetch origin --prune'
-wstool update -t $WORKSPACE/src jsk-ros-pkg/jsk_robot --delete-changed-uris
-ln -sf $ROSINSTALL $WORKSPACE/src/.rosinstall
-wstool update -t $WORKSPACE/src --delete-changed-uris
-# 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'
-wstool update -t $WORKSPACE/src
-WSTOOL_UPDATE_RESULT=$?
+WSTOOL_STATUS=$(wstool status -t $WORKSPACE/src)
+if [ -n "$WSTOOL_STATUS" ]; then
+ echo -e "Please commit robot internal change and send pull request.
" >> $TMP_MAIL_BODY_FILE
+ echo -e $WSTOOL_STATUS >> $TMP_MAIL_BODY_FILE
+ # escape " ' , -- and add change line code to end of line
+ wstool diff -t $WORKSPACE/src | sed -e "s/'/ /g" -e "s/^--/ /g" -e 's/"/ /g' -e "s/
/\\\n/" -e 's/$/
/g' -e "s/,/ /g" | tee -a $TMP_MAIL_BODY_FILE
+fi
+if [ "${UPDATE_WORKSPACE}" == "true" ]; then
+ wstool foreach -t $WORKSPACE/src --git 'git stash -u'
+ wstool foreach -t $WORKSPACE/src --git 'git fetch origin --prune'
+ wstool update -t $WORKSPACE/src $(rospack find jsk_robot_startup)/../.. --delete-changed-uris
+ 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 update -t $WORKSPACE/src
+ WSTOOL_UPDATE_RESULT=$?
+else
+ WSTOOL_UPDATE_RESULT=0
+fi
# Rosdep Install
if [ "${ROSDEP_INSTALL}" == "true" ]; then
sudo apt-get update -y;