From 63b6bcab70aa1052e59198cccac5c3ae1eb03306 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 5 Jun 2015 12:37:21 +0200 Subject: [PATCH] Add repository migration step to preserve history --- migrate.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/migrate.sh b/migrate.sh index a0160f058f4..44b808c1836 100755 --- a/migrate.sh +++ b/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>" " $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 " org.elasticsearch<\/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>" " $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 in the plugins parent project as it does not exist insertLinesBefore "<\/project>" " § <\/modules>" "§" "plugins/pom.xml" - +git add plugins/pom.xml +git commit -m "add modules section" # Analysis migratePlugin "analysis-kuromoji" migratePlugin "analysis-smartcn"