DESCRIPTION

Implement project rename and move for some cases

We can now move and rename projects within a repository for a number
of cases. Moving a project to a subdirectory does not work and since
Eclipse actually destroys the project, we simply forbid it for now
(Platform bug 307140). The bug is only worked around in Eclipse 3.7,
i.e. forbidden in the UI.

This also adds tests for move and delete of folders and files. We are
quite inconsistent with respect to how we handle the index so the
current behavior may not be the final behavior.

We cannot move projects with repositories inside them in this
version and so we forbid it. Disconnect and share manually
to accomplish this.

Bug: 334112
Change-Id: I634d5b44bc7fc6a7453b5d718733c9f8f3542840
Signed-off-by: Juliet Cantu xxx@xxx.xxx


COMMENTS

author: Gerrit Johnathan Pham
date: 2011-08-10 18:42:27.000000000

Your change could not be merged due to a path conflict.

Please merge (or rebase) the change locally and upload the resolution for review.

-------------------------------------
author: Juliet Cantu
date: 2011-08-29 20:50:03.000000000

Uploaded patch set 11.

-------------------------------------
author: Brenden Conley
date: 2011-08-29 20:50:09.000000000

Patch Set 11:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/1563/ 

-------------------------------------
author: Brenden Conley
date: 2011-08-29 21:00:44.000000000

Patch Set 11: Build Successful

Build Successful 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/1563/ : SUCCESS

-------------------------------------
author: Carlie Harper
date: 2011-08-30 15:46:23.000000000

Patch Set 11: I would prefer that you didn't submit this

(4 inline comments)



Line:291, org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java -> typo? s/we/will

Line:310, org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java -> Shouldn't it be P2 now? The test succeeds, but only because the GitMoveDeleteHook does nothing, and eclipse moves the RepositoryProvider property, and the GitProvider still contains the old RepositoryMapping.

The GitMoveDeleteHook does nothing wrt RepositoryMapping, the condition 

newLocationFile.getAbsolutePath().contains(
		srcm.getRepository().getWorkTree().getAbsolutePath()) 

in line 217 is not fulfilled.

If the project were outside the eclipse workspace, the GitMoveDeleteHook would try to do something, but it would fail with java.lang.StringIndexOutOfBoundsException in line 231.

Line:97, org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/TestProject.java -> If path is simple, i.e. just the project name, then ppath.lastSegment().equals(path) is true and as a consequence locatioURI is set to null (the default location). The parameter insidews is not taken into account in this case. Please fix that.

I think (!ppath.lastSegment().equals(path) || !insidews) would work.

Line:205, org.eclipse.egit.core/src/org/eclipse/egit/core/GitMoveDeleteHook.java -> Please check additionally if the sourceLocation is equal to the newLocation. This is the case for a simple rename. We should allow that.

-------------------------------------
author: Juliet Cantu
date: 2011-08-30 21:40:28.000000000

Patch Set 11: (2 inline comments)



Line:310, org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java -> Good catch.

Line:205, org.eclipse.egit.core/src/org/eclipse/egit/core/GitMoveDeleteHook.java -> No. The resources framework does not allow this, so we do not need to allow.

-------------------------------------
author: Carlie Harper
date: 2011-08-31 07:21:26.000000000

Patch Set 11: (1 inline comment)



Line:205, org.eclipse.egit.core/src/org/eclipse/egit/core/GitMoveDeleteHook.java -> I thought of something like 

if (sourceLocation.isPrefixOf(newLocation) && !sourceLocation.equals(newLocation)) 

to catch the case where a project is renamed but not moved to another location. I think this works in eclipse and we should react on that by renewing the repository mapping. We could even skip the step of moveIndexContent in this case because the relative paths do not change.

However, I propose to handle the case of renaming a project in another change. If you agree, you could just remove or change the test testMoveProjectContainingGitRepo and then we can submit this change. Afterwards I can make a proposal about what I have in mind about the rename case.

-------------------------------------
author: Juliet Cantu
date: 2011-09-08 00:59:36.000000000

Patch Set 11: (1 inline comment)



-------------------------------------
author: Juliet Cantu
date: 2011-09-08 00:59:35.000000000

MISMATCHED INLINE COMMENT
Line:205, org.eclipse.egit.core/src/org/eclipse/egit/core/GitMoveDeleteHook.java -> right...

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