Add repository migration step to preserve history
This commit is contained in:
parent
c6ce4221bc
commit
63b6bcab70
28
migrate.sh
28
migrate.sh
|
@ -13,7 +13,7 @@ set -o pipefail
|
|||
# ./migrate.sh
|
||||
# mvn clean install -DskipTests
|
||||
|
||||
DIR_TMP="migration"
|
||||
DIR_TMP="../migration"
|
||||
MODULE_CORE="core"
|
||||
GIT_BRANCH="refactoring/maven"
|
||||
PARENT_NAME="elasticsearch-parent"
|
||||
|
@ -59,17 +59,19 @@ function removeLines() {
|
|||
# migratePlugin short_name
|
||||
function migratePlugin() {
|
||||
PLUGIN_GIT_REPO="https://github.com/elastic/elasticsearch-$1.git"
|
||||
|
||||
git remote add remote_$1 $PLUGIN_GIT_REPO
|
||||
git fetch remote_$1 > /dev/null 2>/dev/null
|
||||
echo "## Add $1 module from $PLUGIN_GIT_REPO"
|
||||
|
||||
|
||||
# echo "### fetch $1 project from $PLUGIN_GIT_REPO in plugins"
|
||||
# If you want to run that locally, uncomment this line and comment one below
|
||||
#cp -R ../elasticsearch-$1/* plugins/$1
|
||||
git clone $PLUGIN_GIT_REPO plugins/$1 > /dev/null 2>/dev/null
|
||||
|
||||
# We can now add plugin module
|
||||
insertLinesBefore " <\/modules>" " <module>$1<\/module>" "§" "plugins/pom.xml"
|
||||
|
||||
# git clone $PLUGIN_GIT_REPO plugins/$1 > /dev/null 2>/dev/null
|
||||
git checkout -b migrate_$1 remote_$1/master > /dev/null 2>/dev/null
|
||||
git remote rm remote_$1 > /dev/null 2>/dev/null
|
||||
mkdir -p plugins/$1
|
||||
git mv -k * plugins/$1 > /dev/null 2>/dev/null
|
||||
git rm .gitignore > /dev/null 2>/dev/null
|
||||
# echo "### change $1 groupId to org.elasticsearch.plugins"
|
||||
# Change the groupId to avoid conflicts with existing 2.0.0 versions.
|
||||
replaceLine " <groupId>org.elasticsearch<\/groupId>" " <groupId>org.elasticsearch.plugin<\/groupId>" "plugins/$1/pom.xml"
|
||||
|
@ -90,8 +92,15 @@ function migratePlugin() {
|
|||
rm plugins/$1/CONTRIBUTING.md
|
||||
|
||||
# echo "### commit changes"
|
||||
git add --all .
|
||||
git commit -m "add $1 module" > /dev/null
|
||||
git checkout $GIT_BRANCH
|
||||
git merge -m "migrate branch for $1" migrate_$1 > /dev/null 2>/dev/null
|
||||
# We can now add plugin module
|
||||
insertLinesBefore " <\/modules>" " <module>$1<\/module>" "§" "plugins/pom.xml"
|
||||
git add .
|
||||
git commit -m "add $1 module" > /dev/null
|
||||
git branch -D migrate_$1
|
||||
}
|
||||
|
||||
echo "# STEP 0 : prepare the job"
|
||||
|
@ -183,7 +192,8 @@ echo "# STEP 4 : Migrate plugins"
|
|||
|
||||
# We need to add <modules></modules> in the plugins parent project as it does not exist
|
||||
insertLinesBefore "<\/project>" " <modules>§ <\/modules>" "§" "plugins/pom.xml"
|
||||
|
||||
git add plugins/pom.xml
|
||||
git commit -m "add modules section"
|
||||
# Analysis
|
||||
migratePlugin "analysis-kuromoji"
|
||||
migratePlugin "analysis-smartcn"
|
||||
|
|
Loading…
Reference in New Issue