Skip to content

Instantly share code, notes, and snippets.

@feclare feclare/
Last active Jan 17, 2018

What would you like to do?
# Script to merge all edgex go repos in only one
# It needs the command available at
# Notes:
# - It keeps all the commit history (git log)
# But when you get the log from just a file or directory only new commits are
# shown (git log file_or_path)
# - git blame works
# - This script can be run at any time to get a merge of all the repos
set -e
mkdir edgex-go
cd edgex-go
git init .
cat > Makefile << EOF
.PHONY: build test
go build ./cmd/export-client
go build ./cmd/export-distro
go test \`glide novendor\`
git add Makefile
git commit -sm "Adding makefile"
cat > <<EOF
# EdgeX Foundry Go Services
Go implementation of EdgeX services.
All edgex go [repos]( have been merged into this repo.
The script []( has been used to generate this repo.
## Install and Deploy
Currently only \`export-client\` and \`export-distro\` are functional. \`core-command\`, \`core-metadata\` and \`core-data\` can be compiled but doesn't have a command in cmd
To fetch the code and compile the microservices execute:
go get
cd $GOPATH/src/
glide install
make build
## Community
- Chat:
- Mainling lists:
## License
git add
git commit -sm "Adding README"
git remote add core-domain
git fetch -a core-domain add -P core/domain core-domain master
git remote add core-clients
git fetch core-clients add -P core/clients core-clients master
git remote add core-command
git fetch core-command add -P core/command core-command master
git remote add core-data
git fetch core-data add -P core/data core-data master
git remote add core-metadata
git fetch core-metadata add -P core/metadata core-metadata master
git remote add support-domain
git fetch support-domain add -P support/domain support-domain master
git remote add consul-client
git fetch consul-client add -P support/consul-client consul-client master
git remote add support-logging-client
git fetch support-logging-client add -P support/logging-client support-logging-client master
git remote add support-notifications-client
git fetch support-notifications-client add -P support/notifications-client support-notifications-client master
git remote add export-go
git fetch export-go add -P export export-go master
# Another method that didn't work, duplicated files in root and prefix
# git remote add core-clients
# git fetch core-clients
# git merge -s ours --no-commit --allow-unrelated-histories core-clients/master
# git read-tree --prefix=core/clients core-clients/master
# git commit -sm "Importing core-clients-go"
# git reset --hard
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/consul-client-go/\/edgexfoundry\/edgex-go\/support\/consul-client/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/support-logging-client-go/\/edgexfoundry\/edgex-go\/support\/logging-client/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/core-clients-go/\/edgexfoundry\/edgex-go\/core\/clients/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/core-data-go/\/edgexfoundry\/edgex-go\/core\/data/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/core-domain-go/\/edgexfoundry\/edgex-go\/core\/domain/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/support-domain-go/\/edgexfoundry\/edgex-go\/support\/domain/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/support-notifications-client-go/\/edgexfoundry\/edgex-go\/support\/notifications-client/'
find -name "*.go" | xargs sed -i -e 's/\/edgexfoundry\/export-go/\/edgexfoundry\/edgex-go\/export/'
git commit -sam "Replace edgex import path"
mkdir cmd
git mv export/cmd/client cmd/export-client
git mv export/cmd/distro cmd/export-distro
git commit -sam "Moved export commands to cmd"
git mv export/LICENSE .
find -name "LICENSE-2.0.txt" | xargs git rm
git commit -sm "Moving license file to root, removing duplicated license files"
mkdir docker
git mv export/Dockerfile.* docker/
git mv core/command/Dockerfile docker/Dockerfile.command
git mv core/metadata/Dockerfile docker/Dockerfile.metadata
git mv core/data/Dockerfile docker/
git commit -sm "Moving dockerfiles to ./docker"
glide create --non-interactive
git add glide.yaml
git commit -sm "Adding glide.yaml file"
glide install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.