Skip to content

Instantly share code, notes, and snippets.

@chuwy
Created June 13, 2020 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuwy/a8325fe1f4c6d095fcea34356ed883bd to your computer and use it in GitHub Desktop.
Save chuwy/a8325fe1f4c6d095fcea34356ed883bd to your computer and use it in GitHub Desktop.
Extract enrich repositories from snowplow/snowplow monorepo
#!/bin/sh
cp -R ../snowplow .
cd snowplow/
git filter-repo \
--path 3-enrich/scala-common-enrich \
--path 3-enrich/spark-enrich \
--path 3-enrich/beam-enrich \
--path 3-enrich/stream-enrich \
--path 3-enrich/config \
--path 3-enrich/scala-hadoop-enrich \
--path 3-enrich/hadoop-etl \
--path integration-tests \
--path .github \
--path CONTRIBUTING.md \
--path CHANGELOG \
--path-rename 3-enrich/hadoop-etl/src:modules/hadoop-etl/src \
--path-rename 3-enrich/scala-hadoop-enrich/src:modules/hadoop/src \
--path-rename 3-enrich/scala-common-enrich/.scalafmt.conf:.scalafmt.conf \
--path-rename 3-enrich/scala-common-enrich/.gitignore:.gitignore \
--path-rename 3-enrich/scala-common-enrich/.jvmopts:.jvmopts \
--path-rename 3-enrich/scala-common-enrich/README.md:README.md \
--path-rename 3-enrich/scala-common-enrich/LICENSE-2.0.txt:LICENSE-2.0.txt \
--path-rename 3-enrich/scala-common-enrich/build.sbt:common.sbt \
--path-rename 3-enrich/scala-common-enrich/src:modules/common/src \
--path-rename 3-enrich/scala-common-enrich/project/BuildSettings.scala:project/CommonSettings.scala \
--path-rename 3-enrich/scala-common-enrich/project/Dependencies.scala:project/CommonDependencies.scala \
--path-rename 3-enrich/spark-enrich/src:modules/spark/src \
--path-rename 3-enrich/spark-enrich/build.sbt:spark.sbt \
--path-rename 3-enrich/spark-enrich/project/BuildSettings.scala:project/SparkSettings.scala \
--path-rename 3-enrich/spark-enrich/project/Dependencies.scala:project/SparkDependencies.scala \
--path-rename 3-enrich/beam-enrich/build.sbt:beam.sbt \
--path-rename 3-enrich/beam-enrich/src:modules/beam/src \
--path-rename 3-enrich/beam-enrich/project/BuildSettings.scala:project/BeamSettings.scala \
--path-rename 3-enrich/beam-enrich/project/Dependencies.scala:project/BeamDependencies.scala \
--path-rename 3-enrich/stream-enrich/build.sbt:stream.sbt \
--path-rename 3-enrich/stream-enrich/core:modules/stream \
--path-rename 3-enrich/stream-enrich/kafka:modules/kafka \
--path-rename 3-enrich/stream-enrich/kinesis:modules/kinesis \
--path-rename 3-enrich/stream-enrich/nsq:modules/nsq \
--path-rename 3-enrich/stream-enrich/stdin:modules/stdin \
--path-rename 3-enrich/stream-enrich/integration-tests:modules/integration-tests \
--path-rename 3-enrich/stream-enrich/project/BuildSettings.scala:project/StreamSettings.scala \
--path-rename 3-enrich/stream-enrich/project/Dependencies.scala:project/StreamDependencies.scala \
--path-rename 3-enrich/stream-enrich/project/build.properties:project/build.properties \
--path-rename 3-enrich/stream-enrich/project/plugins.sbt:project/plugins.sbt \
--path-rename 3-enrich/stream-enrich/examples/config.hocon.sample:config/config.hocon.sample \
--path-rename 3-enrich/config:config \
--force
git filter-repo --path 3-enrich --invert-path
beam_extract=$(git log --format=oneline --pretty="%H %s" | grep Beam | head -n 1 | cut -f 1 -d ' ')
git checkout "$beam_extract"^ -- modules/beam/
git checkout "$beam_extract"^ -- beam.sbt
git checkout "$beam_extract"^ -- project/Beam*.scala
git commit -m "Beam Enrich: bring back"
cat CHANGELOG | rg '(^Version|^Release|^Stream\sEnrich|^Spark\sEnrich|^Beam\sEnrich|^Scala\sCommon\sEnrich|^\-\-|^Scala\sHadoop\sEnrich|^Hadoop\sETL)' | sed "s/Version/\nVersion/g" | sed "s/Release/\nRelease/g" > CHANGELOG.new
git am ../0001-Unify.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment