Skip to content
Snippets Groups Projects
Commit e49e0c2d authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

[mCBM 2024] add script to rebase cbmroot if mcbm Geo and Pars repo versions are used

parent 0a257ea8
No related branches found
No related tags found
1 merge request!1765Scripts to use mCBM 2024 separate forks
...@@ -8,7 +8,18 @@ ...@@ -8,7 +8,18 @@
``` ```
./macro/beamtime/mcbm2024/switch_geo_par.sh ./macro/beamtime/mcbm2024/switch_geo_par.sh
``` ```
1. 1. Rebasing Cbmroot
1. Commit **and push** any local files/changes if you were in "mCBM mode" and did local changes in either the
geometry or parameters folders. Otherwise the rebase script will not do anything or they
1. Execute the following script. \
It relies on the presence of a remote pointing to the offical version (e.g. `origin` or `upstream`) and may ask
for some login information when fetching the latest changes depending on your remote definition.
```
./macro/beamtime/mcbm2024/rebase_cbmroot.sh
```
Rebasing directly from the CLI without caring about the state of the geo and params folders will fail if they are
in "mCBM mode" and may lead to a broken local copy \
=> As soon as you start using the `switch_geo_par.sh` script in a Cbmroot copy, rebase it only with this script!!!
# CAVEATS # CAVEATS
...@@ -23,6 +34,10 @@ ...@@ -23,6 +34,10 @@
versions" \ versions" \
=> Switching to another branch or a different detached commit than the "official version" will confuse them \ => Switching to another branch or a different detached commit than the "official version" will confuse them \
=> This in turn has high chances to lead to broken copies of the `geometry` and/or `parameters` folders => This in turn has high chances to lead to broken copies of the `geometry` and/or `parameters` folders
1. **All these scripts apart from the one to commit changes will work only on clean copies!!!** \
=> local changes have to be either committed or deleted/reverted before using them!!! \
=> This also means that the scripts will all switch to the latest remote version. So doing "mcbm > official > mcbm"
may lead to a different commit! And local commits which are not yet pushed may be lost!
1. Space needed: 1. Space needed:
- around `100 MB` for geometries - around `100 MB` for geometries
- around `1.6 GB` for parameters - around `1.6 GB` for parameters
#!/bin/bash
# Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
# SPDX-License-Identifier: GPL-3.0-only
# First commited by Pierre-Alain Loizeau
WAS_MCBM_MODE=0
START_DIR=$PWD
# I: switch of branch/commit. Done only after all checks to avoid Geometry and Parameter folder going out of sync
# (one in "Official detached commit" and the other on "mCBM repo HEAD" mode)
# I-A: Geometry folder
# I-A-1) Go to folder
cd ${VMCWORKDIR}/geometry
# I-A-2) Check if current version is the Official detached commit or the mCBM repo HEAD
if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then
echo "Geometry folder already in official version, no need to switch back"
else
WAS_MCBM_MODE=1
if ! ${VMCWORKDIR}/macro/beamtime/mcbm2024/switch_geo_par.sh; then
echo "Failed switching the geometry and parameters folders back to the official version, stopping there"
exit 1
fi
fi
# I-B: parameters folder
# I-B-1) Go to folder
cd ${VMCWORKDIR}/parameters
# I-B-2) Check if current version is the Official detached commit or the mCBM repo HEAD
if [[ 1 -eq $(git status | grep -c "HEAD detached at") ]]; then
echo "Parameters folder already in official version, no need to switch back"
else
echo "Check on geometry folder should have already reverted the parameters one but still in mCBM mode"
echo "Please check your local folders with git status, your copy may be brocken/have folders out of sync"
exit 2
fi
cd $START_DIR
# II: Cbmroot update in the standard way,
# => assumes in the source root folder but should anyway work anywhere in the tree
# => assumes that the official repo remote is already defined (e.g. either as origin or upstream)
official=$(git remote -v | grep fetch | grep "computing/cbmroot.git" | cut -f1)
if [ -n "${official}" ]; then
# Depending on your remote settings, the next command may ask for login/password information
git fetch ${official}
git rebase ${official}/master
else
echo "No remote found pointing to the official cbmroot repository/fork, rebase will not be done!!!!"
fi
# III: revert geometry and parameters folders to mCBM mode if was the case before this call
if [[ 1 -eq ${WAS_MCBM_MODE} ]]; then
${VMCWORKDIR}/macro/beamtime/mcbm2024/switch_geo_par.sh
fi
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment