[education/rkward] scripts: Modernize import script

Thomas Friedrichsmeier null at kde.org
Mon May 9 21:03:23 BST 2022

Git commit aa2199de7d8f4cf94f4c0fb5178828b5bf778e72 by Thomas Friedrichsmeier.
Committed on 05/05/2022 at 20:19.
Pushed by tfry into branch 'master'.

Modernize import script

M  +8    -16   scripts/import_external_plugin.sh


diff --git a/scripts/import_external_plugin.sh b/scripts/import_external_plugin.sh
index 4e146bfe..ccdd6d7d 100755
--- a/scripts/import_external_plugin.sh
+++ b/scripts/import_external_plugin.sh
@@ -13,11 +13,13 @@
 # Example:
 # import_external_plugin.sh rk.power/inst/rkward/rkwarddev_power_plugin_script.R rkward/plugins/rkwarddev_scripts
-cd `dirname $0`/..
+cd `dirname $0`
+cd ${SCRIPTDIR}/..
 cd ${BASEDIR}
@@ -28,24 +30,14 @@ git pull --rebase
 # clone and filter external repo
 git clone ${EXTERNAL_REPO} import_tmp
 cd ${WORKDIR}
-git remote rm origin # safety measure
-# first split out the target into a single dir. For simplicity, we use ${TARGET_PATH}, here
-git filter-branch --prune-empty --tree-filter "
-if [ -e ${SOURCE_PATH} ]; then
-  mkdir -p ${TARGET_PATH}
-# next filter that single dir
-git filter-branch -f --subdirectory-filter ${TARGET_PATH} -- --all
-mkdir -p ${TARGET_PATH}
-mv * ${TARGET_PATH}
-git add .
-git commit -m "Import ${SOURCE_PATH} from external_plugins repository"
+#git remote rm origin # safety measure
+git-filter-repo --path ${SOURCE_PATH} --path-rename 'inst/rkward/':${TARGET_PATH}
+git-filter-repo --mailmap ${SCRIPTDIR}/committer_map.txt
 # merge into main repo
 cd ${BASEDIR}
 git remote add external_repo_import ${WORKDIR}
-git pull --no-rebase external_repo_import master
+git pull --no-rebase external_repo_import master --allow-unrelated-histories
 git remote rm external_repo_import
 # Done

More information about the rkward-tracker mailing list