Add support for reverting multiple commits at once.

This modifies the Revert Commit menu item in the History view such that
multiple selected commits may be reverted at once, instead of only a
single commit.

JGit-Dependency: I5de3a9a2a4c276e60af732e9c507cbbdfd1a4652
Change-Id: I42cce1cecfb6f871d5187960925bde79603c3a3e
Signed-off-by: Maik Schreiber <blizzy@blizzy.de>
Release lock on all paths in scheduleReloadJob()

FindBugs found out that lock is not released on all paths in
scheduleReloadJob(). Moved the lock outside the first try block to
make sure it is acquired only after the block is finished (including
finally).

Change-Id: If05cb0260fd2381017e27b98be4d03ff274cab20
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Merge "Release lock on all paths in scheduleReloadJob()"
Fix IteratorService performance on big repositories/workspaces

IWorkspaceRoot.findContainersForLocationURI(URI) method performs very
poor on big repositories and workspaces, and gets even worse with lot of
links in the workspace too.

The fix tries first to get the direct workspace resources map hit by
using IWorkspaceRoot.getContainerForLocation(IPath) and only if this
fails, fail over to the slow findContainersForLocationURI method.

This works very fast for almost all cases (constant execution time) and
adds only a small overhead if the matching project/folder is contained
in a *closed* project which overlaps location of another *opened*
project.

Bug: 440722
Change-Id: Ia6eda95f082111355cf96209db588664c59476b6
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Introduce IndexDiffUpdateJob to schedule resource updates

The IndexDiffCacheEntry currently immediately schedules update jobs on
resource changes. Given a resource related task which affects multiple
resources in 'n' workspace changes (e.g. "clean compile" on n projects),
IndexDiffCacheEntry.scheduleUpdateJob() is called n times on same
repository, creating n jobs (which in worst case creates n threads in
Eclipse), running one after each other and creating n notifications on
completion. This significantly affects Eclipse UI performance on huge
git repositories.

To avoid this, one single (collecting resources) IndexDiffUpdateJob is
created and used per IndexDiffCacheEntry. On each resource change
pending changes are collected by this job, but instead of immediate
scheduling default delay of 400 milliseconds is used to schedule the
job. This reduces both memory consumption and overhead by reducing
notifications count to UI listeners.

Bug: 417597
Change-Id: I0922cf83623bd15fee80569b31986990028e7c9d
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Do not disable staged/unstaged viewers during merge

Do not always disable viewers as they are used during merge/rebase.
Instead, disable them during commit only and add half busy cursor to
indicate "work in progress" state.

Bug: 440758
Change-Id: Ife0705c0f461f576da61cd3adfea8225bc202e03
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Fix PushCommand.name to be "Push..."

The name is shown in Quick Access. As it starts a wizard, it should end
with "...".

Bug: 440904
Change-Id: If4d36f8004a84bf6c716535d7e53d542e56ac5ab
Signed-off-by: Robin Stocker <robin@nibor.org>
Push Branch: Don't suggest branch name of local upstream branch

In case the upstream branch is local, it makes more sense to suggest the
name of the branch itself.

Bug: 440347
Change-Id: Id8b3351898e1d435170692d7799964f6451be697
Signed-off-by: Robin Stocker <robin@nibor.org>
Fix invalid thread access in BranchOperationUI

The methods shouldCancelBecauseOfRunningLaunches, getTargetWithDialog
and getTargetWithCheckoutRemoteTrackingDialog all assume they are
running in the UI thread. This is not the case when the operation is
called from FetchGerritChangePage.

Bug: 434343
Change-Id: Ic030e314e41a9a1596bc491f53abcd77a1ab4903
Signed-off-by: Andreas Hermann <a.v.hermann@gmail.com>
Merge "Fix invalid thread access in BranchOperationUI"
Fix NPE in CommitMessageViewer.getBranches when db is null

The following can be reproduced by running one of HistoryViewTest:

java.lang.NullPointerException
  at org.eclipse.egit.ui.internal.history.CommitMessageViewer.getBranches(CommitMessageViewer.java:389)
  at org.eclipse.egit.ui.internal.history.CommitMessageViewer.setInput(CommitMessageViewer.java:366)
  at org.eclipse.egit.ui.internal.history.GitHistoryPage.clearCommentViewer(GitHistoryPage.java:1081)
  at org.eclipse.egit.ui.internal.history.GitHistoryPage.clearHistoryPage(GitHistoryPage.java:1074)
  at org.eclipse.egit.ui.internal.history.GitHistoryPage.setFocus(GitHistoryPage.java:1060)

Change-Id: Ie14380c7f13d54ca264f83b442ea55e2ec813ed0
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Add Team context menu for working sets

The menu now shows repository actions in case all projects of a working
set are connected to the same Git repository. This is enabled by adding
a property tester that does the logic in code instead of XML.

To adjust the enabled checks of some actions, some selection-related
methods were moved out into its own util class. This also made some
other duplicated logic for getting the repository obsolete.

Bug: 311299
Change-Id: I9cbec20e9be14cdf6f41bbd79ace3d1a5a4097bd
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Merge "Push Branch: Don't suggest branch name of local upstream branch"
Cleaned up 3 compiler NPE warnings (false positive)

Eclipse compiler issued false positive about access to indexDiff which
might be null. Simplified code to make compiler happy.

Change-Id: I9905a4df4521abccf8126fb5526856ee9f032d4b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Clone Wizard: Clear unsupported fields when changing protocol

Clears the "user", "password", "host" and "port" fields when not
supported by the protocol.

Bug: 336913
Change-Id: I4f557dee508f2725f3182f2c90216050e438e622
Signed-off-by: Andreas Hermann <a.v.hermann@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Enable Create Patch for first commit in the history view

Change-Id: Ibea61c875a3eafae624b0ec13cfb9d9b1f8e4e19
Prevent NPEs at plugin start and stop

PlatformUI.getWorkbench() will fail if the workbench hasn't
been initialized yet, or during shutdown. This protects
calls to it within checks for isWorkbenchRunning.

Change-Id: Iddbad2f9b8f8ba81c652d366bdc7fce71f19df7e
Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Use TestUtil for getting Package Explorer tree

Change-Id: Idcc3d52ba511e12d45d731c1ace3177e4586d505
Signed-off-by: Robin Stocker <robin@nibor.org>
Try to fix HistoryViewTest instability

Recently failed here:
https://hudson.eclipse.org/egit/job/egit.gerrit/6114/

Maybe using the Team menu and showing the view explicitly helps.

Change-Id: I578f2210d60a50c797a0c41ac7a5d21cfce0b143
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
[historyView] Track renamed paths and provide to actions

Several History view actions currently fail when the view is
set to follow renames since they derive the path used from
the current repository path and do not take into account
older paths that the resource was known as.

This commit creates a simple RenameTracker class that tracks
which commits introduced renames allowing the GitHistoryPage
to provide the previous paths for a specific commit given the
initial path.

At the moment, rename tracking only works when "Show all changes of
selected resource and its children" is checked, because JGit currently
does not allow combining a FollowFilter with e.g. a PathFilter.

The commit also makes the commit viewer's "Compare with Previous
Version" honour renames.

Caveat: This change unfortunately undoes some of the work in
I4ae8abfc4dbe7ed772749afa80743278247585ee and my manual test coverage is
pretty low (IFile and IResource only)

Bug: 374722
Change-Id: Ieddbfb06418b146e5066a7ef2eda51ab4af858e2
AlsoBy: Kevin Sawicki <kevin@github.com>
AlsoBy: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Carsten Pfeiffer <carsten.pfeiffer@gebit.de>