From e8fe80e72e0c6e2cb3240c06c5639af2c7a15c9b Mon Sep 17 00:00:00 2001 From: Florian Vahl Date: Thu, 18 Jan 2024 15:33:31 +0100 Subject: [PATCH] Adapt scripts --- Makefile | 12 +++++------ scripts/git_status.bash | 45 ----------------------------------------- scripts/pull_all.sh | 10 --------- scripts/pull_init.sh | 8 -------- 4 files changed, 6 insertions(+), 69 deletions(-) delete mode 100755 scripts/git_status.bash delete mode 100755 scripts/pull_all.sh delete mode 100755 scripts/pull_init.sh diff --git a/Makefile b/Makefile index 60f2d368c..5d46901cd 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ basler: install: pull-init basler update master: - git submodule foreach -q --recursive 'branch="$$(git config -f $$toplevel/.gitmodules submodule.$$name.branch)"; [ "$$branch" = "" ] && git switch -q master || git switch -q $$branch' + vcs import .. < workspace.repos pip: # Install and upgrade pip dependencies @@ -14,16 +14,16 @@ pip: pre-commit: # Install pre-commit hooks for all submodules that have a .pre-commit-config.yaml file - git submodule foreach -q --recursive "test -f .pre-commit-config.yaml && pre-commit install || :" + pre-commit install pull-all: git pull - scripts/pull_all.sh + vcs pull .. scripts/pull_files.bash pull-init: git pull - scripts/pull_init.sh + vcs import .. < workspace.repos scripts/pull_files.bash pull-files: @@ -32,9 +32,9 @@ pull-files: rosdep: # Update rosdep and install dependencies from meta directory rosdep update - rosdep install -iry --from-paths . + rosdep install -iry --from-paths .. status: - scripts/git_status.bash + vcs status .. update: pull-all rosdep pip pre-commit diff --git a/scripts/git_status.bash b/scripts/git_status.bash deleted file mode 100755 index 3b51511bf..000000000 --- a/scripts/git_status.bash +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -function echo_bold() { - echo -ne "\033[1m$@\033[0m" -} - -submodules=$(git submodule --quiet foreach 'pwd') -folders=". $submodules" - -longest=0 -for folder in $folders; do - length=$(wc -c <<< $(basename $(realpath $folder))) - if [[ $(( $length > $longest )) == 1 ]]; then - longest=$length - fi -done - -for folder in $folders; do - module=$(basename $(realpath $folder)) - length=$(wc -c <<< $module) - branch=$(git -C $folder rev-parse --abbrev-ref HEAD) - modified=$(git -C $folder status --ignore-submodules --porcelain | grep -c "^ M ") - untracked=$(git -C $folder status --ignore-submodules --porcelain | grep -c "^?? ") - deleted=$(git -C $folder status --ignore-submodules --porcelain | grep -c "^ D") - unpushed=$(git -C $folder log --oneline origin/$branch..$branch | wc -l) - echo_bold $module - echo -n ": " - spaces=$(( $longest - $length )) - while [[ $(( $spaces > 0 )) == 1 ]]; do - echo -n " " - spaces=$(( $spaces - 1 )) - done - echo -n "On branch $branch" - [[ $modified != 0 ]] && echo -n ", $modified modified" - [[ $untracked != 0 ]] && echo -n ", $untracked untracked" - [[ $deleted != 0 ]] && echo -n ", $deleted deleted" - if [[ $unpushed == 1 ]]; then - echo -n ", " - echo_bold "1 unpushed commit" - elif [[ $unpushed != 0 ]]; then - echo -n ", " - echo_bold "$unpushed unpushed commits" - fi - echo -done diff --git a/scripts/pull_all.sh b/scripts/pull_all.sh deleted file mode 100755 index 951cad16f..000000000 --- a/scripts/pull_all.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -e - -# This is a temporary hack, so it is not necessary that every user removes these dirs themselfs -rm -rf basler_drivers -rm -rf humanoid_league_msgs -rm -rf bitbots_tools/bitbots_jenkins_library - -git submodule foreach git pull -git -C humanoid_league_misc submodule update diff --git a/scripts/pull_init.sh b/scripts/pull_init.sh deleted file mode 100755 index 6bfc19c99..000000000 --- a/scripts/pull_init.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -{ - git submodule sync && - git submodule update --recursive --remote --init && - git submodule foreach -q --recursive 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; [ "$branch" = "" ] && git switch master || git switch $branch' && - git submodule foreach git pull -} || { echo -e "\033[91m\033[1m########## Pull failed! ##########\033[0m" && exit 1; }