Skip to content

Instantly share code, notes, and snippets.

@davisp
Created February 5, 2014 21:11
Show Gist options
  • Save davisp/8833187 to your computer and use it in GitHub Desktop.
Save davisp/8833187 to your computer and use it in GitHub Desktop.
rcouch subtree split notes
==========================
Starting point:
c73144aaef7f86d169afd685dae121463efea658
This commit is huge and moves lots of things around. First step is
to reset to just before this commit to start our subtree extractions.
add9173866fc5ad4739cd27dab92cacad95e9106
Starting initial extraction branches from this commit:
480c620167b43ede4977a8084f2821e05e980c5f
Initialize our extraction branches:
$ git subtree split -P src/couch_index/ -b split-couch-index-1
$ git subtree split -P src/couch_mrview/ -b split-couch-mrview-1
$ git subtree split -P src/couch_replicator/ -b split-couch-replicator-1
$ git subtree split -P src/couch_collate/ -b split-couch-collate-1
$ git subtree split -P src/couchdb -b split-couchdb-1
These branches need to be first split before the commit that moves all
the code around. Next we'll go back to the tip of 1994-merge-rcouch
and run another set of splits. Notice we don't need to split couch_httpd
because it didn't exist until after the add9173 commit.
And now back to 1994-merge-rcouch tip
$ git reset --hard c73144aaef7f86d169afd685dae121463efea658
And now extract subtrees again:
$ git subtree split -P apps/couch_index/ -b split-couch-index-2
$ git subtree split -P apps/couch_mrview/ -b split-couch-mrview-2
$ git subtree split -P apps/couch_replicator/ -b split-couch-replicator-2
$ git subtree split -P apps/couch_collate/ -b split-couch-collate-2
$ git subtree split -P apps/couch -b split-couchdb-2
$ git subtree split -P apps/couch_httpd -b split-couch-httpd
Now we have before and after branches for the big commit. The next
step is to attempt rebasing the after branch onto the before so that
we have the full history once its in the external repository. First I'll
do a detailed description of this for couch_index and then just discuss
any issues I have with merges for the other apps.
I'm using split-couch-index-3 here so that I don't foul up one of the
other split branches in case I need to redo the rebase.
$ git checkout -b split-couch-index-3 split-couch-index-2
$ git rebase split-couch-index-1
And this was followed by massive failure...
After reading the commit history a bit closer I realized that rcouch's
source moves are significantly more complicated than I had originally
though. The pattern looks like this:
src/appname -> apps/appname -> src/apps/appname -> apps/appname
The commits involved are:
e62a4fc17a0af5e51b02e23e78528f41bc3ee644 - move src/* to the root
941a8236c33a248b77abc8fa546a082d08c18bd9 - move sources to src
add9173866fc5ad4739cd27dab92cacad95e9106 - inital move to rebar compilation
That means I have to create a branch for every swap as well as make
sure that I limit the commit ranges because apps/appname exists
twice and seems to pull in massive amounts of unrelated history for
some reason. So... here goes:
$ git branch -D split-couch-index-2
$ git branch -D split-couch-index-3
$ git subtree split -P apps/couch_index -b split-couch-index-2 add9173..941a823^
$ git subtree split -P apps/couch_index -b split-couch-index-3 e62a4fc..HEAD
$ git checkout -b split-couch-index-4 split-couch-index-3
$ git rebase couch-split-index-2
$ git rebase couch-split-index-1
Each of the merge conflicts during the rebase was trivial to resolve. Now
we need to repeat these steps for all of our other apps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment