DESCRIPTION

WIP: Let staging view use submodule repos

If the staging view is linked to the selected resource and if that
resource belongs to a submodule then staging view should also run in
the context of the submodule repo. This allows to work with submodules
in a similar manner than with native git. If I want to do a commit in a
submodule repo then select a resource in that submodule repo and you can
use Staging view to prepare the commit in the submodule repo. In native
git you would "cd" to a folder containing a file from the submodule to
switch context from the containing repo to the submodule repo. In Egit
you have to select a resource from the submodule to achieve the same.

Requires JGit commit 23bd74fb6abceee443565237d9e311f4f0eae190

Change-Id: I6cbd5d5f4d0f57e93ce40a9dfb54e7b7c67e2e3a


COMMENTS

author: Zachary Orozco
date: 2014-10-21 09:43:49.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-10-21 09:43:55.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-10-21 09:45:26.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/6425/ : FAILURE

-------------------------------------
author: Carlie Harper
date: 2014-10-24 15:01:12.000000000

Patch Set 1: Code-Review-1

(3 comments)

Line:153, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> This works, but I think it does not quite fit to the overall concept of the RepositoryMapping class. The assumption is that there is one repository. Methods like getRepoRelativePath make use of that assumption.

There are many, many places in EGit which just call getRepository(). If we'd change all these places to use getRepository(IResource res) do a submodule walk in case there are submodules we may get a performance penalty.

Line:1880, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> I think this should be adapted also to mapping.getRepository(resource)

Line:17, /COMMIT_MSG -> That works fine, besides the corner case I commented in the Staging View, line 1880.

But, on the other hand, it does only a small step when it comes to working with submodules nested in one eclipse project. Still the History View, the Team menu, the Compare With and Replace With menu, the toolbar buttons, the reflog view and the decorators are still not connected to the submodule repository. And I am sure I forgot something. 

I am not sure if all these other places can simply be changed in the same way as the Staging View. I am not sure if the concept of the RepositoryMapping would still be suited if we had more than one repository per project.

-------------------------------------
author: Douglas Trujillo
date: 2014-11-04 14:17:06.000000000

Patch Set 1:

(3 comments)

Line:153, org.eclipse.egit.core/src/org/eclipse/egit/core/project/RepositoryMapping.java -> Using submodulewalk shouldn't be a big penalty since it's typically just traversing the DirCache to find submodule entries. Though we could improve that if we teach IndexDiff to cache and incrementally update submodule entries based on resource change events.

Line:17, /COMMIT_MSG -> I tested this change rebased on current master on Eclipse Mars M2 and found that it's working properly if the sources contained in submodules each live in their own separate Eclipse projects. Hence I think we should accept this change for this use case (submodules in separate projects) and clearly state that it doesn't yet work for projects spanning super project and submodule.

I tried successfully:
* history View
* team menu
* compare with
* replace with
* toolbar buttons
* reflog view
* decorators

there are a few problems left and I will file bugs for those.

If super project and submodules reside in the same Eclipse project I can see all the problems you mentioned. So there is quite some work needed to make this work, I think to support that we would have to first enhance RepositoryMapping to handle projects spanning multiple git repositories.

Line:21, /COMMIT_MSG -> add footer to link related bugs

Bug: 382093 ?
Bug: 411742 ?
Bug: 446344

-------------------------------------
author: Brenden Conley
date: 2014-11-04 14:17:27.000000000

Patch Set 1: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-11-04 14:33:36.000000000

Patch Set 1: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/6442/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2014-11-04 14:50:14.000000000

Patch Set 1: -Code-Review

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

-------------------------------------
author: Brenden Conley
date: 2014-11-04 15:05:03.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/6443/ : SUCCESS

-------------------------------------
author: Carlie Harper
date: 2014-12-10 11:54:11.000000000

Patch Set 1:

(2 comments)

Line:1880, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java -> Done

Line:21, /COMMIT_MSG -> Done

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