Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349177

Summary: [releng] stitch ui.workbench fork back into main
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, bokowski, emoffatt, jamesblackburn+eclipse, john.arthorne, kim.moir, remy.suen
Version: 4.1   
Target Milestone: 4.1.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 349150    
Bug Blocks: 328935    

Description Paul Webster CLA 2011-06-13 07:04:38 EDT
When we started with org.eclipse.ui.workbench, we forked it into the e4 incubator.  Now it need to be stitched back into the real org.eclipse.ui.workbench.

My first suggestion would be that we play the forked HEAD as branch R4_HEAD, similar to how we branched projects that didn't need such extensive changes.

PW
Comment 1 Boris Bokowski CLA 2011-06-13 09:38:56 EDT
After the Git migration?
Comment 2 Paul Webster CLA 2011-06-13 11:13:28 EDT
I think after we've converted both o.e.ui.workbenches to git, as it probably would be easier to stitch them together then.

PW
Comment 3 James Blackburn CLA 2011-06-17 11:29:13 EDT
This is pretty straight-forward to do, Paul's comment 2 is right. 
  1) Import both of them into git
  2) push --mirror the e4 repo into the the 3.x repo
  3) If the SHA-1's at the fork point are identical, you're done!
  4) If not (though brownian motion, package rename, etc.) create a graft of from the first commit in e4 back to the parent commit in 3.x.
  5) Fast export and re-import to make the graft permanent: 
     git fast-export --all | (mkdir ../repo2 && cd ../repo2 && git init && git fast-import)

I did this back in the e4 core.resources days for generating patches to bring e4 head back into line.

If at various points 3.x changes have been merged into e4 then you can graft the merge from 3.x into the e4 branch in the git history.

The other neat thing you can do is fix-up history where content has been committed into another repository (without moving the ,v files).  
In CDT, for example, we had a couple wholesale commits to CDT HEAD of code originating from DSF.  In the git migration I've grafted the original history back in so that blame and log can help developers see the full context of the migrated code!
Comment 4 Boris Bokowski CLA 2011-06-17 11:51:09 EDT
(In reply to comment #3)
> The other neat thing you can do is fix-up history where content has been
> committed into another repository (without moving the ,v files).  

Sounds cool - bringing back the history from "before the mist of time", which in our case is the RCP split that happened for 3.0. Probably too much work for too little benefit though.
Comment 5 Paul Webster CLA 2011-06-29 07:35:59 EDT
For now I've created a temp repo containing only our fork: git://git.eclipse.org/e4/eclipse.platform.ui.compat.git

We'll experiment with trying to suck this into a branch off of the 3.5 workbench when we forked, or simply pulling it in its own branch and then merging into the 4.2 stream.

PW
Comment 6 Paul Webster CLA 2011-06-29 07:41:25 EDT
(In reply to comment #5)
> For now I've created a temp repo containing only our fork:
> git://git.eclipse.org/e4/eclipse.platform.ui.compat.git

git://git.eclipse.org/gitroot/e4/eclipse.platform.ui.compat.git
Comment 7 Paul Webster CLA 2011-06-29 20:26:53 EDT
James, once I get the compat repo into my platform repo, I have a branch point on master and I have the first commit of my fork.

When you say create a graft, do mean like this: http://ben.straubnet.net/post/939181602/git-grafting-repositories

PW
Comment 8 James Blackburn CLA 2011-07-01 12:53:36 EDT
(In reply to comment #7)
> James, once I get the compat repo into my platform repo, I have a branch point
> on master and I have the first commit of my fork.

If you see a branch point in the DAG then there's nothing more to do.  

Right.  So if the SHA-1's of your e4 repo don't correspond to the SHAs of equivalent commits in the platform, then you can use a graft to change the edges in the graph so that:

3.x repo: ... -> X1 -> Fork_Point -> X2 -> ...
e4  repo: ... -> Y1 -> Fork_Point -> Y2 -> ...

Where X1 and Y1 have the same content but different hashes due to the import process.

becomes 
              ... -> X1 -> Fork_Point -> X2 -> ...  3.x/master branch
                                                   \-> Y2 ->    e4 branch

If the repository already looks like the latter (which it will do if the hashes match) then there's nothing more to do.  You should probably also check that there aren't any collisions in the date tagging between the e4 and 3.x repo...

As git is just a DAG of commits, and all operation operate on this DAG (there's no additional metadata about history - a merge is just a tree-state/commit with >1 parent...), you can use grafts to re-draw the graph between the commits. So you can splice in history in (like we did in CDT), or re-parent a branch from another repo.

See also:
https://git.wiki.kernel.org/index.php/GraftPoint
Comment 9 Paul Webster CLA 2011-07-04 19:18:54 EDT
We should try and graft at 2 points.  2009-12-17 and 2010-03-02

PW
Comment 10 Paul Webster CLA 2011-07-07 09:44:30 EDT
(In reply to comment #3)
>   5) Fast export and re-import to make the graft permanent: 
>      git fast-export --all | (mkdir ../repo2 && cd ../repo2 && git init && git
> fast-import)

James, if I make the graft permanent will it effect the content of the commits in that branch?  Or is it just changing the parent and the hash?

PW
Comment 11 Paul Webster CLA 2011-07-07 09:52:59 EDT
(In reply to comment #10)
> James, if I make the graft permanent will it effect the content of the commits
> in that branch?  Or is it just changing the parent and the hash?

The answer is it doesn't appear to effect the tree

PW
Comment 12 Paul Webster CLA 2011-07-07 13:34:48 EDT
I've included org.eclipse.ui.workbench with the eclipse.platform.ui.e4 graduated bundles.

I've decided against grafting the history.

PW
Comment 13 Paul Webster CLA 2011-07-07 16:44:41 EDT
Done with bug 351489
PW