Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add initial script to do a coreth diff #1295

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions scripts/apply_diff_and_rename.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Add other repo as a remote: `git remote add -f coreth git@github.com:ava-labs/coreth.git`.
# Usage: ./scripts/apply_diff_and_rename.sh coreth/master (or subnet-evm/master)

set -e;
set -u;

ROOT=$(git rev-parse --show-toplevel);
cd "${ROOT}";

BASE="${1}";

git diff .."${BASE}" --binary | git apply --whitespace=nowarn

if [[ "${BASE}" == coreth* ]]; then
echo "Replacing coreth with subnet-evm"
sed_command='s!github.com/ava-labs/coreth!github.com/ava-labs/subnet-evm!g'
else
echo "Replacing subnet-evm with coreth"
sed_command='s!github.com/ava-labs/subnet-evm!github.com/ava-labs/coreth!g'
fi

# TODO: improve this command that finds all the "coreth" references and replaces them with "subnet-evm"
sed_inplace=(sed -i) # Linux
if [[ $(uname) == "Darwin" ]]; then
sed_inplace=(sed -i '')
fi
LANG=C find . -type f \! -name 'apply_diff_and_rename.sh' \! -path './.git/*' \! -path './contracts/node_modules/*' -exec "${sed_inplace[@]}" -e "${sed_command}" {} \;
gofmt -w .
go mod tidy

# Restore contracts/.gitignore
git checkout -- contracts/.gitignore 2>/dev/null || true # Ignore if the file doesn't exist
Comment on lines +33 to +34
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should remove these lines for less special casing and merge ava-labs/coreth#638 before getting started instead

Loading