Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kinzler2011-02-17 22:25:29 +0000
committerMatthias Sohn2011-02-17 22:28:06 +0000
commit2a91d984e03278beef680eb20d8c3376ae5cb522 (patch)
treeeb037de702053d77bdf8e6d1e0dcc13156afe135 /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
parent8fc4e6d843acf51ba249543103c42f034780b458 (diff)
downloadegit-2a91d984e03278beef680eb20d8c3376ae5cb522.tar.gz
egit-2a91d984e03278beef680eb20d8c3376ae5cb522.tar.xz
egit-2a91d984e03278beef680eb20d8c3376ae5cb522.zip
[historyView] Performance second part
This limits the number of commits to show in the history page to ten thousand. This is a UI Preference available on the Git Preference page. The user can set this to zero in order to see all commits. The second thing is to hide the "tag sequence" by default. This is very time and memory-consuming on big repositories. This is changeable by another Git Preference. In combination, this makes browsing the Linux 2.6 repository work without too much waiting and memory overflow. Bug: 337081 Change-Id: Ie2823c3c24c2ee9a1a9baf1a6c314901bf8b4a12 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
index 768e655a3c..eb4cd0cb44 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
+import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
import org.eclipse.egit.ui.internal.trace.GitTraceLocation;
import org.eclipse.osgi.util.NLS;
@@ -23,6 +24,9 @@ import org.eclipse.osgi.util.NLS;
class GenerateHistoryJob extends Job {
private static final int BATCH_SIZE = 256;
+ private final int maxCommits = Activator.getDefault().getPreferenceStore()
+ .getInt(UIPreferences.HISTORY_MAX_NUM_COMMITS);
+
private final GitHistoryPage page;
private final SWTCommitList allCommits;
@@ -45,6 +49,7 @@ class GenerateHistoryJob extends Job {
@Override
protected IStatus run(final IProgressMonitor monitor) {
IStatus status = Status.OK_STATUS;
+ boolean incomplete = false;
try {
if (trace)
GitTraceLocation.getTrace().traceEntry(
@@ -60,27 +65,30 @@ class GenerateHistoryJob extends Job {
GitTraceLocation.HISTORYVIEW.getLocation(),
"Filling commit list"); //$NON-NLS-1$
allCommits.fillTo(oldsz + BATCH_SIZE - 1);
- if (monitor.isCanceled() || oldsz == allCommits.size())
+ if (monitor.isCanceled()) {
+ page.setErrorMessage(NLS.bind(
+ UIText.GenerateHistoryJob_CancelMessage, page
+ .getName()));
+ return Status.CANCEL_STATUS;
+ }
+ if (maxCommits > 0 && allCommits.size() > maxCommits)
+ incomplete = true;
+ if (incomplete || oldsz == allCommits.size())
break;
+ monitor.setTaskName(NLS
+ .bind("Found {0} commits", Integer.valueOf(allCommits.size()))); //$NON-NLS-1$
final long now = System.currentTimeMillis();
if (now - lastUpdateAt < 2000 && lastUpdateCnt > 0)
continue;
- updateUI();
+ updateUI(incomplete);
lastUpdateAt = now;
}
} catch (IOException e) {
status = new Status(IStatus.ERROR, Activator.getPluginId(),
UIText.GenerateHistoryJob_errorComputingHistory, e);
}
-
- if (monitor.isCanceled()) {
- page.setErrorMessage(NLS
- .bind(UIText.GenerateHistoryJob_CancelMessage, page
- .getName()));
- return Status.CANCEL_STATUS;
- }
- updateUI();
+ updateUI(incomplete);
} finally {
monitor.done();
if (trace)
@@ -90,17 +98,17 @@ class GenerateHistoryJob extends Job {
return status;
}
- void updateUI() {
+ void updateUI(boolean incomplete) {
if (trace)
GitTraceLocation.getTrace().traceEntry(
GitTraceLocation.HISTORYVIEW.getLocation());
try {
- if (allCommits.size() == lastUpdateCnt)
+ if (!incomplete && allCommits.size() == lastUpdateCnt)
return;
final SWTCommit[] asArray = new SWTCommit[allCommits.size()];
allCommits.toArray(asArray);
- page.showCommitList(this, allCommits, asArray);
+ page.showCommitList(this, allCommits, asArray, incomplete);
lastUpdateCnt = allCommits.size();
} finally {
if (trace)

Back to the top