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

Bug 368844

Summary: split out R4E from Mylyn Reviews git repository
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Alvaro Sanchez-Leon <alvaro.sanchez-leon>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: lmcbout, sebastien.dubois
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on: 369630    
Bug Blocks: 368836    

Description Steffen Pingel CLA 2012-01-17 11:20:53 EST
Move the R4E source code to a separate repository, by splitting from the current git repository and preserving the history using git filter-branch.

The following bundles should be moved to the org.eclipse.mylyn.reviews.r4e repository:

pre. 
./framework/org.eclipse.mylyn.reviews.frame.core
./r4e/org.eclipse.mylyn.reviews.r4e.feature
./r4e/org.eclipse.mylyn.reviews.r4e.ui
./r4e/org.eclipse.mylyn.reviews.notifications
./r4e/org.eclipse.mylyn.reviews.r4e.mail.smtp
./r4e/org.eclipse.mylyn.reviews.VCalendar
./r4e/org.eclipse.mylyn.reviews.r4e.report
./r4e/org.eclipse.mylyn.reviews.r4e.core
./r4e/org.eclipse.mylyn.reviews.r4e.help
./r4e/org.eclipse.mylyn.reviews.r4e.core.tests
./r4e/org.eclipse.mylyn.reviews.r4e.reports-feature
./r4e/org.eclipse.mylyn.reviews.r4e.ldap
./r4e/org.eclipse.mylyn.reviews.r4e.transform

The following bundles should remain in the org.eclipse.mylyn.reviews repository:

pre. 
./gerrit/org.eclipse.mylyn.gerrit.feature
./gerrit/org.eclipse.mylyn.gerrit.core.tests
./gerrit/org.eclipse.mylyn.gerrit.tests
./gerrit/org.eclipse.mylyn.gerrit.ui
./gerrit/org.eclipse.mylyn.gerrit.target
./gerrit/org.eclipse.mylyn.gerrit.ui.tests
./gerrit/org.eclipse.mylyn.gerrit.core
./framework/org.eclipse.mylyn.reviews.sdk.feature
./framework/org.eclipse.mylyn.reviews.ui
./framework/org.eclipse.mylyn.reviews.feature
./framework/org.eclipse.mylyn.reviews.core
./tbr/org.eclipse.mylyn.reviews.tasks.dsl
./tbr/org.eclipse.mylyn.reviews.tasks
./tbr/org.eclipse.mylyn.reviews.tasks.core
./tbr/org.eclipse.mylyn.reviews.tasks.ui
./tbr/org.eclipse.mylyn.versions.tasks.ui
./tbr/org.eclipse.mylyn.versions.tasks.mapper.generic
./tbr/org.eclipse.mylyn.versions.tasks.core
Comment 1 Alvaro Sanchez-Leon CLA 2012-01-17 21:15:06 EST
(In reply to comment #0)
> Move the R4E source code to a separate repository, by splitting from the current
> git repository and preserving the history using git filter-branch.
> 
> The following bundles should be moved to the org.eclipse.mylyn.reviews.r4e
> repository:
> 
> pre.
> ./framework/org.eclipse.mylyn.reviews.frame.core
> ./r4e/org.eclipse.mylyn.reviews.r4e.feature

using git-filter-branch can help to create a repo from one folder, 
is it possible to create a repo from two folders e.g. ./framework and ./r4e ?

if not, I guess will need to create one repository for each.
Comment 2 Steffen Pingel CLA 2012-01-19 09:32:07 EST
This might work to remove/keep multiple directories:

git clone --mirror git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.reviews.git
cd org.eclipse.mylyn.reviews.git
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch gerrit releng scm tbr versions org.eclipse.mylyn.reviews* framework/org.eclipse.mylyn.reviews.?[^r]*" --prune-empty -f -- --all
Comment 3 Alvaro Sanchez-Leon CLA 2012-01-19 12:45:02 EST
Yes, this is a possibility although it does not transform to a flat structure.

The second alternative is to use:
     git filter-branch --prune-empty --subdirectory-filter r4e -- --all
   This would leave all the bundles underneath r4e at the root and preserving all the bundle commit history, but we leave out the framework component which would need to go into another repo or add the current snap shot on top and commit it as new within the new structure.
     
Using the first alternative and then move the bundles one level up to convert it to a flat structure is possible however the commit history separates after the move for each of the bundles.

Any thoughts ?
Comment 4 Steffen Pingel CLA 2012-01-19 15:11:32 EST
(In reply to comment #3)
> The second alternative is to use:
> git filter-branch --prune-empty --subdirectory-filter r4e -- --all
> This would leave all the bundles underneath r4e at the root and preserving
> all the bundle commit history, but we leave out the framework component which
> would need to go into another repo or add the current snap shot on top and
> commit it as new within the new structure.

I would not recommend creating two repositories, particularly if one of the repositories will have a single bundle only. I would simply move directories up to the root level in a second step, e.g.:

git filter-branch --tag-name-filter --prune-empty --tree-filter 'mv r4e/* . || true; mv framework/* . || true' -f -- --all
Comment 5 Alvaro Sanchez-Leon CLA 2012-01-23 17:55:47 EST
(In reply to comment #4)
> (In reply to comment #3)
> > The second alternative is to use:
> > git filter-branch --prune-empty --subdirectory-filter r4e -- --all
> > This would leave all the bundles underneath r4e at the root and preserving
> > all the bundle commit history, but we leave out the framework component which
> > would need to go into another repo or add the current snap shot on top and
> > commit it as new within the new structure.
> 
> I would not recommend creating two repositories, particularly if one of the
> repositories will have a single bundle only. I would simply move directories up
> to the root level in a second step, e.g.:
> 
You are right, we should not keep one repository for one bundle

> git filter-branch --tag-name-filter --prune-empty --tree-filter 'mv r4e/* . ||
> true; mv framework/* . || true' -f -- --all

I tried this approach and some commits did not succeed to rewrite e.g. 
ite 4d6ffc82dae946c6519878588833ad825e2e96bf (201/592)mv: cannot move `framework/org.eclipse.mylyn.reviews.frame.core' to `./org.eclipse.mylyn.reviews.frame.core'
Rewrite 50f59b9e7660378b92f9bb553afe98e24f0b0faa (248/592)mv: cannot move `r4e/org.eclipse.mylyn.reviews.r4e.egitproxy' to `./org.eclipse.mylyn.reviews.r4e.egitproxy'
Rewrite 3d85aef415bb8c17ea1d5e417667b7dfae1e8585 (278/592)mv: cannot move `r4e/org.eclipse.mylyn.reviews.r4e.core' to `./org.eclipse.mylyn.reviews.r4e.core'
Rewrite cab5aa70f8ac729b3a631bf98183ddbbb9524697 (293/592)mv: cannot move `r4e/org.eclipse.mylyn.reviews.r4e.core' to `./org.eclipse.mylyn.reviews.r4e.core'
Rewrite 6abe1ff830124efeba2abbbd55cf8ff876182411 (303/592)mv: cannot move `r4e/org.eclipse.mylyn.reviews.r4e.core' to `./org.eclipse.mylyn.reviews.r4e.core'
Rewrite 73756c034826fe906048d8fae16a04ad7be51db6 (307/592)mv: cannot move `r4e/org.eclipse.mylyn.reviews.r4e.help' to `./org.eclipse.mylyn.reviews.r4e.help'

It completed but the result has some problems e.g. some commits are rewritten with a different changeset compare to the original 
I pushed the resulting repo to github at:

git://github.com/lmcalvs/r4e_mv_dirs_up.git
https://github.com/lmcalvs/r4e_mv_dirs_up.git
https://github.com/lmcalvs/r4e_mv_dirs_up/zipball/master

To see the problem 
1) open the history log for org.eclipse.mylyn.reviews.frame.core
2) compare with the change set of the latest commits against the current one from Eclipse.org

Not sure what's causing it
Comment 6 Alvaro Sanchez-Leon CLA 2012-01-23 18:08:14 EST
The second approach is to create one repo extracting the contents of r4e at the top, 
create a temporary repo moving  org.eclipse.mylyn.reviews.frame.core folder at the top
then from a working clone pull the tree from the temporary repo i.e. o.e.m.r.frame.core
then push the merged three to the initial bare repo.

This can be seen by using three shells as follows, note that commands on shell3 need to be executed after shell1 and shell2

shell1:
git clone --mirror git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.reviews.git bare_r4e.git

cd bare_r4e.git
git config core.autocrlf false
git filter-branch --prune-empty --subdirectory-filter r4e -- --all

shell2:
git clone --mirror git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.reviews.git bare_frame.git
cd bare_frame.git
git config core.autocrlf false
git filter-branch --prune-empty --subdirectory-filter framework -- --all
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch pom.xml org.eclipse.mylyn.reviews.?[^r]*" --prune-empty -f -- --all


shell3 (Wait for Shell1 and Shell2 to complete)
git clone /c/Users/lmcalvs/git_repos/bare_r4e.git org.eclipse.mylyn.reviews.r4e
cd org.eclipse.mylyn.reviews.r4e
git config core.autocrlf false
git remote add bare_frame /c/Users/lmcalvs/git_repos/bare_frame.git
git pull bare_frame master
git push origin


The three reflects the commits properly although the commits for org.eclipse.mylyn.reviews.frame.core follow its own line and commits that involved changes on other bundles are split in two one for the frame.core and the other one with the rest.
egit represents the history nicely as they appear chronologically,  msysgit shows them in one separate line at the top.
  Since there are not that many commits (a bit over 20), it does not seem to be a big issue.
   
The resulting repo is availabel form github at:
  git://github.com/lmcalvs/r4e_frame_merge.git
  https://github.com/lmcalvs/r4e_frame_merge.git
  https://github.com/lmcalvs/r4e_frame_merge/zipball/master

Please give it a try and let me know what you think

NOTE: All the icon files are still present in order to compare the results better, once we agree on how to integrate the bundles I can post the sequence of commands to clean it up from unwanted icons
Comment 7 Steffen Pingel CLA 2012-01-23 19:34:07 EST
I don't see the errors described in comment 5 when I run the the commands on Linux. Whichever method you think it's best is fine mine. In the end we should just ensure that running the migration on build.eclipse.org produces the desired result.
Comment 8 Alvaro Sanchez-Leon CLA 2012-01-24 08:07:28 EST
I made a slight modification to your proposed script as in comment 4 in order to perform the moves one folder at a time, the commits preserve the changes from the two folders as expected, so the script would look like:

git clone --mirror git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.reviews.git

cd org.eclipse.mylyn.reviews.git
git config core.autocrlf false
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch gerrit releng scm tbr versions org.eclipse.mylyn.reviews* framework/pom.xml framework/org.eclipse.mylyn.reviews.?[^r]*" --prune-empty -f -- --all
git filter-branch --tag-name-filter --prune-empty --tree-filter 'mv r4e/* . || true' -f -- --all
git filter-branch --tag-name-filter --prune-empty --tree-filter 'mv framework/* . || true' -f -- --all
Comment 9 Steffen Pingel CLA 2012-01-24 09:02:47 EST
Sounds good to me. Is there a test repository on GitHub already?
Comment 10 Alvaro Sanchez-Leon CLA 2012-01-24 09:20:45 EST
The resulting repo as per comment 8, is now available at Eclipse.org
Give it a try and let me know so we can proceed to remove the icons and pictures that need to be replaced

  Committer: git clone ssh://committer_id@git.eclipse.org/gitroot/r4e/org.eclipse.mylyn.reviews.r4e.git
  Anonymous: git clone git://git.eclipse.org/gitroot/r4e/org.eclipse.mylyn.reviews.r4e.git
Comment 11 Steffen Pingel CLA 2012-01-24 10:23:16 EST
Looks pretty good. I noticed a few empty commits. Not sure why these were not pruned. 

I would consider filtering pom.xml and README.txt in the top-level directory since these aren't relevant to R4E.

As the last step you should run these commands to clean up backup and unreferenced nodes:

rm -rf refs/original/
git reflog expire --expire=now --all
git gc --aggressive --prune=now
Comment 12 Steffen Pingel CLA 2012-01-24 10:24:13 EST
(In reply to comment #10)
> Give it a try and let me know so we can proceed to remove the icons and pictures
> that need to be replaced

This will be done as part of the git filter-branch command, right?
Comment 13 Alvaro Sanchez-Leon CLA 2012-01-24 11:26:06 EST
(In reply to comment #11)
> Looks pretty good. I noticed a few empty commits. Not sure why these were not
> pruned.
> 
> I would consider filtering pom.xml and README.txt in the top-level directory
> since these aren't relevant to R4E.

Ok, I will remove with 
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch pom.xml README.txt" --prune-empty -f -- --all

> 
> As the last step you should run these commands to clean up backup and
> unreferenced nodes:
> 
> rm -rf refs/original/
> git reflog expire --expire=now --all
> git gc --aggressive --prune=now

Yes, will add that to start clean and compact
Comment 14 Alvaro Sanchez-Leon CLA 2012-01-24 11:29:35 EST
(In reply to comment #12)
> (In reply to comment #10)
> > Give it a try and let me know so we can proceed to remove the icons and
> pictures
> > that need to be replaced
> 
> This will be done as part of the git filter-branch command, right?
I will run the following once we are ok with the actual structure and contents
the following commands will remove the icons previously discussed and any pictures showing the icons

git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/part_obj.png  org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/partauthr_obj.png  org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/partcont_obj.png  org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/partlead_obj.png  org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/partorg_obj.png  org.eclipse.mylyn.reviews.r4e.ui/icons/obj16/partrevr_obj.png' HEAD

git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch org.eclipse.mylyn.reviews.r4e.help/doc/images/AddAnomaliesCompareEditor.jpg org.eclipse.mylyn.reviews.r4e.help/doc/images/ImportAnomalies.png org.eclipse.mylyn.reviews.r4e.help/doc/images/ImportAnomaliesView.pngorg.eclipse.mylyn.reviews/r4e/org.eclipse.mylyn.reviews.r4e.help/doc/images/NewParticipant.png org.eclipse.mylyn.reviews.r4e.help/doc/images/NewRule.png org.eclipse.mylyn.reviews.r4e.help/doc/images/NewRuleViolation.png org.eclipse.mylyn.reviews.r4e.help/doc/images/OpenFile.png org.eclipse.mylyn.reviews.r4e.help/doc/images/R4E_main.png/ReviewNavigatorView.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialAddGlobalAnomaly.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialAddParticipant.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialAddParticipant2.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialMarkUserReviewed.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialNavigatorView1.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialNavigatorView2.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialNavigatorViewInformal1.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialNewComment.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialNewLinkedAnomaly.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialProgressReview.png org.eclipse.mylyn.reviews.r4e.help/doc/images/TutorialSendEmail.png' HEAD

git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/AddAnomaliesCompareEditor.jpg org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/ImportAnomalies.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/ImportAnomaliesView.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/NewParticipant.png org.eclipse.mylyn.reviews.r4e.help/doc/NewRule.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/NewRuleViolation.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/OpenFile.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/R4E_main.png/ReviewNavigatorView.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialAddGlobalAnomaly.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialAddParticipant.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialAddParticipant2.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialMarkUserReviewed.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialNavigatorView1.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialNavigatorView2.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialNavigatorViewInformal1.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialNewComment.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialNewLinkedAnomaly.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialProgressReview.png org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/images/TutorialSendEmail.png' HEAD

git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch org.eclipse.mylyn.reviews.r4e.help/doc/AddAnomaliesCompareEditor.jpg org.eclipse.mylyn.reviews.r4e.help/doc/ImportAnomalies.png org.eclipse.mylyn.reviews.r4e.help/doc/ImportAnomaliesView.png org.eclipse.mylyn.reviews.r4e.help/doc/NewParticipant.png org.eclipse.mylyn.reviews.r4e.help/doc/NewRule.png org.eclipse.mylyn.reviews.r4e.help/doc/NewRuleViolation.png org.eclipse.mylyn.reviews.r4e.help/doc/OpenFile.png org.eclipse.mylyn.reviews.r4e.help/doc/R4E_main.png/ReviewNavigatorView.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialAddGlobalAnomaly.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialAddParticipant.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialAddParticipant2.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialMarkUserReviewed.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialNavigatorView1.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialNavigatorView2.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialNavigatorViewInformal1.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialNewComment.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialNewLinkedAnomaly.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialProgressReview.png org.eclipse.mylyn.reviews.r4e.help/doc/TutorialSendEmail.png' HEAD
Comment 15 Alvaro Sanchez-Leon CLA 2012-01-24 11:51:10 EST
I managed to remove empty commits (with a single parent commit) by adding a plain:

git filter-branch -f --prune-empty

README and pom at the top level are also gone,  so you can re-clone to take a look
Comment 16 Steffen Pingel CLA 2012-01-24 14:12:58 EST
Interestingly the initial commit from Kilian didn't get removed even though it looks empty. Not sure if it's worth getting rid of that. Have you tried filtering the .gitignore file as well? There seem to be a few merge commits that would disappear. It's totally minor though. To me this looks pretty good.
Comment 17 Alvaro Sanchez-Leon CLA 2012-01-24 14:49:16 EST
I removed the .gitignore and re-run the command to remove empty commits however empty merge commits remain and the initial commit from Kilian as well.
   I think this is quite acceptable as well.
Comment 18 Steffen Pingel CLA 2012-01-25 01:19:36 EST
+1 from my point of view
Comment 19 Alvaro Sanchez-Leon CLA 2012-01-25 23:00:47 EST
The icons and related images are now removed, 
you will need to re-clone the repository once more but I think it's now ready to be used.
Comment 20 Steffen Pingel CLA 2012-02-01 13:16:03 EST
Looks like we are done here?
Comment 21 Alvaro Sanchez-Leon CLA 2012-02-16 20:53:08 EST
Split is now completed and in use.