Community
Participate
Working Groups
There is a problem in the Git Connector where the path returned when getting a FileRevision full storage path is invalid. The returned path is missing the root of the Git Repository (i.e. is starts one level too low). This can cause multiple problems that could be very hard to track. In our case, when using R4E to import Git Files as review item components for a Review, this could cause the compare editor to open the wrong file versions and show incorrect information. So for example the following code will not return the correct path in artifactPath IPath artifactPath = scmArtifact.getFileRevision(null).getStorage(null).getFullPath(); The solution is to prepend the repository path to the artifact path. Take note that this is done correctly in Egit, but not in Mylyn Versions Git connector.
Created attachment 198220 [details] tentative solution for bug 349739 This is a tentative solution for bug 349739
Take note that I have included a tentative solution for this bug. Since I cannot commit changes to mylyn versions (I am not a committer on this project), I would like it to be reviewed and included ASAP. Thanks, /Sebastien
Created attachment 198221 [details] updated comments in code
I have made a quick check on the serialized data and I don't see any segments missing e.g. I used the R4E commit, 2011-Jun-17, 09:51:49, id: e5376d6.. See the repository paths below, they start with r4e which is the correct folder relative to the root of the repository. Please clarify what's missing. <r4ecore:R4EFileVersion xmi:id="_CUCfQ57JEeCvAPj6HzzVzA" platformURI="platform:/resource/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" versionID="d26261e5d1552c35eecd3925a1b0332d8883e817" repositoryPath="r4e/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" name="RModelFactoryImpl.java" localVersionID="d26261e5d1552c35eecd3925a1b0332d8883e817" fileRevision="org.eclipse.mylyn.reviews.r4e.core.rfs.ReviewsRFSProxy$1@128537b"/> <r4ecore:R4EFileVersion xmi:id="_CU73IJ7JEeCvAPj6HzzVzA" platformURI="platform:/resource/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" versionID="d9c767a3b760930e1488d2b71f887b02ffa93984" repositoryPath="r4e/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" name="RModelFactoryImpl.java" localVersionID="d9c767a3b760930e1488d2b71f887b02ffa93984" fileRevision="org.eclipse.mylyn.reviews.r4e.core.rfs.ReviewsRFSProxy$1@6735fd"/> <r4ecore:R4EFileContext xmi:id="_CY80cJ7JEeCvAPj6HzzVzA" type="R4E_MODIFIED">
Like I said it works for R4E by luck, because R4E has a subdirectory r4e below the root repository. But for project that do not have this e.g. JGit this will not work. You can easily reproduce the problem by trying to use commits from JGit. Also take note that, as I also stated above, EGit does the right thing. The Mylyn Versions Git connector does not.
After investigating a little bit more, it appears that the EGit behavior is only valid for indexed files. This means that the real solution to the problem is to fetch the correct contents from the local R4E repository when opening the comapre editor. So the implementation of the solution is done on R4E and the bug is being moved accordingly
Fixed is now available