DESCRIPTION

Fixes obtaining common ancestor in Synchronize view

For obtaining common base ancestor I've used suggested RevWalk with
RevFilter.MERGE_BASE. For API compatibility it is also used for
obtaining remote variant.

This patch also improves GitResourceVariant implementation. I replaced
all dependencies to deprecated TreeEntry with proper RevObject
implementation. This have also requires to update test cases.

Bug: 317934
Change-Id: I8f5352862d01e5a5475a74f222241970cd7960ee
Signed-off-by: Leslie Stephenson xxx@xxx.xxx


COMMENTS

author: Leslie Stephenson
date: 2010-07-20 17:54:19.000000000

Uploaded patch set 5.

-------------------------------------
author: Carlie Harper
date: 2010-07-21 13:13:37.000000000

Patch Set 5:

I do not get errors in GitResourceVariantTreeSubscriberTest.
What kind of errors do you get?

However, I sporadically get errors like pasted below, but not only on Synchronize tests and also without this change.

Contains: Error deleting resource '/Project-1' from the workspace tree.
org.eclipse.core.internal.resources.ResourceException: Could not delete metadata for '/Project-1'.
	at org.eclipse.core.internal.resources.LocalMetaArea.delete(LocalMetaArea.java:101)
	at org.eclipse.core.internal.resources.Project.deleteResource(Project.java:345)
	at org.eclipse.core.internal.resources.ResourceTree.deletedProject(ResourceTree.java:169)
	at org.eclipse.core.internal.resources.ResourceTree.internalDeleteProject(ResourceTree.java:438)
	at org.eclipse.core.internal.resources.ResourceTree.standardDeleteProject(ResourceTree.java:837)
	at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1942)
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:786)
	at org.eclipse.core.internal.resources.Project.delete(Project.java:331)
	at org.eclipse.egit.core.test.TestProject.dispose(TestProject.java:138)
	at org.eclipse.egit.core.test.GitTestCase.tearDown(GitTestCase.java:51)

and 
java.io.IOException: C:\Users\D044495\Documents\NWDS\workspaces\junit-workspace\.git\refs in use or undeletable
	at org.eclipse.egit.core.test.TestUtils.deleteRecursive(TestUtils.java:55)
	at org.eclipse.egit.core.test.TestUtils.deleteRecursive(TestUtils.java:49)
	at org.eclipse.egit.core.test.GitTestCase.tearDown(GitTestCase.java:52)
	at org.eclipse.egit.core.test.op.ResetOperationTest.tearDown(ResetOperationTest.java:55)

-------------------------------------
author: Leslie Stephenson
date: 2010-07-21 13:20:17.000000000

Patch Set 5:

I've got an assertation error in shouldReturnCommonAncestorAsBase:
org.eclipse.team.core.TeamException: Missing unknown 5627e24a52af6d58955a333b785646b72f37d9eb
	at org.eclipse.egit.core.synchronize.GitBaseResourceVariantTree.getRevCommit(GitBaseResourceVariantTree.java:52)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTree.getResourceVariant(GitResourceVariantTree.java:64)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriberTest.commonAssertionsForBaseTree(GitResourceVariantTreeSubscriberTest.java:197)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriberTest.shouldReturnCommonAncestorAsBase(GitResourceVariantTreeSubscriberTest.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 5627e24a52af6d58955a333b785646b72f37d9eb
	at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:778)
	at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:681)
	at org.eclipse.egit.core.synchronize.GitBaseResourceVariantTree.getRevCommit(GitBaseResourceVariantTree.java:44)
	... 46 more

and TeamException in shouldReturnRemoteTree:
org.eclipse.team.core.TeamException: 
	at org.eclipse.egit.core.synchronize.GitRemoteResourceVariantTree.getRevCommit(GitRemoteResourceVariantTree.java:46)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTree.getResourceVariant(GitResourceVariantTree.java:64)
	at org.eclipse.egit.core.synchronize.GitResourceVariantTreeSubscriberTest.shouldReturnRemoteTree(GitResourceVariantTreeSubscriberTest.java:163)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 5627e24a52af6d58955a333b785646b72f37d9eb
	at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:778)
	at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:681)
	at org.eclipse.egit.core.synchronize.GitRemoteResourceVariantTree.getRevCommit(GitRemoteResourceVariantTree.java:44)
	... 45 more

It is very strange since those tests passes when they are run in "single" mode :|

-------------------------------------
author: Anonymous Coward
date: 2010-07-22 07:19:20.000000000

Patch Set 5:

Dariusz, perhaps you can 'bisect' the failing tests?

Start with running the failing test with all the tests, and then split the test suite into two. Run the GitResourceVariantTreeTest with one half. If it fails, you have eliminated half the tests as part of the failing combination. If it does not, run the failing test with the other half of the tests.

Wash, rinse, repeat and you'll know which minimal combination of tests fails, which should bring you closer to discovering the root issue.

-------------------------------------
author: Leslie Stephenson
date: 2010-07-22 15:51:12.000000000

Patch Set 5:

Thanks Robert, this is actually quite good idea. I'll try it out! ;)

-------------------------------------
