py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

How to migrate your pull request from py-evm to the trinity repository

Open pipermerriam opened this issue 6 years ago • 3 comments

We have just executed #728 which moves the p2p and trinity modules from this repository into https://github.com/ethereum/trinity

Anyone with an open pull request that touches either of the p2p or trinity modules will need to migrate their pull requests from this repository into the new one. The following guide should help with this process.

1. fork the ethereum/trinity repository

First you need to get your own fork of the https://github.com/ethereum/trinity repository.

In order to migrate the commits in your local py-evm branches, do not clone the repo to your machine. Instead:

2. setting up your local version of the trinity repo

Before doing this ensure that you have pulled the latest master for py-evm

In your projects directory where your py-evm repository lives make a copy of the project directory and change into that new directory.

cp -R path/to/py-evm new/path/to/trinity
cd new/path/to/trinity

3. resetting your git history to 76276d586f5a365acdf79d8b7e823b607ea419a9

Now, from within our new trinity repository, you need to reset your master branch

git checkout master
git reset --hard 76276d586f5a365acdf79d8b7e823b607ea419a9

4. updating your remotes.

Now you need to edit the .git/config file. It should currently look something like this.

$ cat .git/config
[remote "upstream"]
        url = [email protected]:ethereum/py-evm.git
        fetch = +refs/heads/*:refs/remotes/upstream/*
[remote "origin"]
        url = [email protected]:pipermerriam/py-evm.git
        fetch = +refs/heads/*:refs/remotes/pipermerriam/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[submodule "fixtures"]
        active = true
        url = https://github.com/ethereum/tests.git

You need to replace all of the places that are currently pointed at py-evm to now point at trinity. The above file would become:

[remote "upstream"]
        url = [email protected]:ethereum/trinity.git
        fetch = +refs/heads/*:refs/remotes/upstream/*
[remote "origin"]
        url = [email protected]:pipermerriam/trinity.git
        fetch = +refs/heads/*:refs/remotes/pipermerriam/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[submodule "fixtures"]
        active = true
        url = https://github.com/ethereum/tests.git

5. pulling down new changes from the main trinity repo

Now you need to pull down any new changes from the trinity repository. This command will vary depending on how you name your remotes. For the config above, the command would be:

git pull upstream master

6. rebasing your local branches.

Next you'll need to switch to your local branch for your pull request and rebase it on top of the new master for the trinity repository.

git checkout my-branch
git rebase master

See https://help.github.com/articles/about-git-rebase/ for more information on rebasing

7. open your new pull request in the ethereum/trinity repository.

You can do this by simply copy/pasting the pull request text from the py-evm issue into a new pull request under the trinity repository. Please provide a link to the old pull request in the new pull request.

pipermerriam avatar Dec 21 '18 18:12 pipermerriam

It seems like it would be simpler (though slower) to run a fresh checkout of your personal ethereum/trininty fork, and add the upstream remote as usual. (skipping steps 2-4)

Maybe it's worth listing reasons not to do that like:

  • you keep copies of your local work (branches) in your new trinity repo
  • anything else?

carver avatar Dec 21 '18 20:12 carver

you keep copies of your local work (branches) in your new trinity repo

This was the primary motivation. People have existing forks and this seemed like an approach that would preserve those. I'm open to other options. It wasn't clear to me how to have people's history show up correctly in their newly forked trinity repository without just having them do a full copy of their existing p-evm one

pipermerriam avatar Dec 21 '18 20:12 pipermerriam

Totally, I just updated the instructions to help motivate this other migration method: :+1:

carver avatar Dec 21 '18 21:12 carver