Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladislav.Soroka
2013-10-21 19:09:39 +04:00
9 changed files with 58 additions and 24 deletions
@@ -16,13 +16,11 @@ import java.util.List;
*/
public interface VcsLogProvider {
int COMMIT_BLOCK_SIZE = 1000;
/**
* Reads {@link #COMMIT_BLOCK_SIZE the first part} of the log.
* Reads the given number of the most recent commits from the log.
*/
@NotNull
List<? extends VcsFullCommitDetails> readFirstBlock(@NotNull VirtualFile root, boolean ordered) throws VcsException;
List<? extends VcsFullCommitDetails> readFirstBlock(@NotNull VirtualFile root, boolean ordered, int commitCount) throws VcsException;
/**
* Reads the whole history, but only hashes & parents.
@@ -24,4 +24,17 @@ public interface VcsLogSettings {
* Sets if the details pane (which shows commit meta-data) should be shown or hidden by default.
*/
void setShowDetails(boolean showDetails);
/**
* Returns the number of recent commits which are loaded initially by default, and are always stored in memory.
*/
int getRecentCommitsCount();
/**
* Sets the number of recent commits which are loaded initially by default, and always stay in memory.
* The more this number is, the more memory is occupied, but the faster filtering works, and more commits can be viewed back in history
* without need to load additional details from the VCS.
*/
void setRecentCommitsBlockSize(int commitCount);
}
@@ -97,6 +97,7 @@ public class VcsLogDataHolder implements Disposable {
@NotNull private final CommitDetailsGetter myDetailsGetter;
@NotNull private final VcsLogJoiner myLogJoiner;
@NotNull private final VcsLogMultiRepoJoiner myMultiRepoJoiner;
@NotNull private final VcsLogSettings mySettings;
/**
* Encapsulates all information about the log, which can be accessed by external clients.
@@ -124,7 +125,7 @@ public class VcsLogDataHolder implements Disposable {
@NotNull private final Map<Hash, VcsFullCommitDetails> myTopCommitsDetailsCache = ContainerUtil.newConcurrentMap();
public VcsLogDataHolder(@NotNull Project project, @NotNull VcsLogObjectsFactory logObjectsFactory,
@NotNull Map<VirtualFile, VcsLogProvider> logProviders) {
@NotNull Map<VirtualFile, VcsLogProvider> logProviders, @NotNull VcsLogSettings settings) {
myProject = project;
myLogProviders = logProviders;
myDataLoaderQueue = new BackgroundTaskQueue(project, "Loading history...");
@@ -133,6 +134,7 @@ public class VcsLogDataHolder implements Disposable {
myLogJoiner = new VcsLogJoiner();
myMultiRepoJoiner = new VcsLogMultiRepoJoiner();
myFactory = logObjectsFactory;
mySettings = settings;
}
/**
@@ -143,13 +145,13 @@ public class VcsLogDataHolder implements Disposable {
* <li>Loads the whole log in background. When completed, substitutes the data and tells the UI to refresh itself.</li>
* </ul>
*
* @param settings
* @param onInitialized This is called when the holder is initialized with the initial data received from the VCS.
* The consumer is called on the EDT.
*/
public static void init(@NotNull final Project project, @NotNull VcsLogObjectsFactory logObjectsFactory,
@NotNull Map<VirtualFile, VcsLogProvider> logProviders,
@NotNull final Consumer<VcsLogDataHolder> onInitialized) {
final VcsLogDataHolder dataHolder = new VcsLogDataHolder(project, logObjectsFactory, logProviders);
@NotNull VcsLogSettings settings, @NotNull final Consumer<VcsLogDataHolder> onInitialized) {
final VcsLogDataHolder dataHolder = new VcsLogDataHolder(project, logObjectsFactory, logProviders, settings);
dataHolder.initialize(onInitialized);
}
@@ -231,7 +233,8 @@ public class VcsLogDataHolder implements Disposable {
VcsLogProvider logProvider = entry.getValue();
// read info from VCS
List<? extends VcsFullCommitDetails> firstBlockDetails = logProvider.readFirstBlock(root, fairRefresh);
List<? extends VcsFullCommitDetails> firstBlockDetails = logProvider.readFirstBlock(root, fairRefresh,
mySettings.getRecentCommitsCount());
Collection<VcsRef> newRefs = logProvider.readAllRefs(root);
// some commits may be no longer available (e.g. rewritten after rebase), but let them stay in the cache:
@@ -30,6 +30,7 @@ import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.VcsLogObjectsFactory;
import com.intellij.vcs.log.VcsLogProvider;
import com.intellij.vcs.log.VcsLogRefresher;
import com.intellij.vcs.log.VcsLogSettings;
import com.intellij.vcs.log.data.VcsLogDataHolder;
import com.intellij.vcs.log.ui.VcsLogColorManagerImpl;
import com.intellij.vcs.log.ui.VcsLogUI;
@@ -50,13 +51,16 @@ public class VcsLogManager extends AbstractProjectComponent {
@NotNull private final ProjectLevelVcsManager myVcsManager;
@NotNull private final VcsLogObjectsFactory myLogObjectsFactory;
@NotNull private final VcsLogSettings mySettings;
private PostponeableLogRefresher myLogRefresher;
protected VcsLogManager(@NotNull Project project, @NotNull ProjectLevelVcsManager vcsManagerInitializedFirst,
@NotNull VcsLogObjectsFactory logObjectsFactory) {
@NotNull VcsLogObjectsFactory logObjectsFactory, @NotNull VcsLogSettings settings) {
super(project);
myVcsManager = vcsManagerInitializedFirst;
myLogObjectsFactory = logObjectsFactory;
mySettings = settings;
}
@Override
@@ -87,11 +91,12 @@ public class VcsLogManager extends AbstractProjectComponent {
changesView.addContent(content);
content.setCloseable(false);
VcsLogDataHolder.init(myProject, myLogObjectsFactory, logProviders, new Consumer<VcsLogDataHolder>() {
VcsLogDataHolder.init(myProject, myLogObjectsFactory, logProviders, mySettings, new Consumer<VcsLogDataHolder>() {
@Override
public void consume(VcsLogDataHolder vcsLogDataHolder) {
Disposer.register(myProject, vcsLogDataHolder);
VcsLogUI logUI = new VcsLogUI(vcsLogDataHolder, myProject, new VcsLogColorManagerImpl(logProviders.keySet()));
VcsLogUI logUI = new VcsLogUI(vcsLogDataHolder, myProject, mySettings,
new VcsLogColorManagerImpl(logProviders.keySet()));
mainPanel.init(logUI.getMainFrame().getMainComponent());
myLogRefresher = new PostponeableLogRefresher(myProject, vcsLogDataHolder, content);
refreshLogOnVcsEvents(logProviders);
@@ -17,6 +17,7 @@ public class VcsLogSettingsImpl implements VcsLogSettings, PersistentStateCompon
public static class State {
public boolean SHOW_DETAILS = false;
public int RECENT_COMMITS_COUNT = 1000;
}
@Nullable
@@ -40,4 +41,14 @@ public class VcsLogSettingsImpl implements VcsLogSettings, PersistentStateCompon
myState.SHOW_DETAILS = showDetails;
}
@Override
public int getRecentCommitsCount() {
return myState.RECENT_COMMITS_COUNT;
}
@Override
public void setRecentCommitsBlockSize(int commitCount) {
myState.RECENT_COMMITS_COUNT = commitCount;
}
}
@@ -5,6 +5,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.Hash;
import com.intellij.vcs.log.VcsLogSettings;
import com.intellij.vcs.log.compressedlist.UpdateRequest;
import com.intellij.vcs.log.data.DataPack;
import com.intellij.vcs.log.data.VcsLogDataHolder;
@@ -36,11 +37,12 @@ public class VcsLogUI {
@Nullable private GraphElement prevGraphElement;
public VcsLogUI(@NotNull VcsLogDataHolder logDataHolder, @NotNull Project project, @NotNull VcsLogColorManager manager) {
public VcsLogUI(@NotNull VcsLogDataHolder logDataHolder, @NotNull Project project, @NotNull VcsLogSettings settings,
@NotNull VcsLogColorManager manager) {
myLogDataHolder = logDataHolder;
myColorManager = manager;
myFilterer = new VcsLogFilterer(logDataHolder, this);
myMainFrame = new MainFrame(myLogDataHolder, this, project);
myMainFrame = new MainFrame(myLogDataHolder, this, project, settings);
project.getMessageBus().connect(project).subscribe(VcsLogDataHolder.REFRESH_COMPLETED, new Runnable() {
@Override
public void run() {
@@ -3,7 +3,6 @@ package com.intellij.vcs.log.ui.frame;
import com.intellij.icons.AllIcons;
import com.intellij.ide.actions.RefreshAction;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.ui.JBColor;
@@ -12,8 +11,8 @@ import com.intellij.ui.SeparatorOrientation;
import com.intellij.vcs.log.VcsLogSettings;
import com.intellij.vcs.log.data.VcsLogDataHolder;
import com.intellij.vcs.log.ui.GitLogIcons;
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
import com.intellij.vcs.log.ui.VcsLogUI;
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
import com.intellij.vcs.log.ui.filter.VcsLogFilterUi;
import org.jetbrains.annotations.NotNull;
@@ -33,11 +32,12 @@ public class MainFrame {
@NotNull private final VcsLogSettings mySettings;
@NotNull private final VcsLogFilterUi myFilterUi;
public MainFrame(@NotNull VcsLogDataHolder logDataHolder, @NotNull VcsLogUI vcsLogUI, @NotNull Project project) {
public MainFrame(@NotNull VcsLogDataHolder logDataHolder, @NotNull VcsLogUI vcsLogUI, @NotNull Project project,
@NotNull VcsLogSettings settings) {
myLogDataHolder = logDataHolder;
myUI = vcsLogUI;
myProject = project;
mySettings = ServiceManager.getService(myProject, VcsLogSettings.class);
mySettings = settings;
myActiveSurface = new ActiveSurface(logDataHolder, vcsLogUI, project);
myActiveSurface.setupDetailsSplitter(mySettings.isShowDetails());
@@ -58,9 +58,10 @@ public class GitLogProvider implements VcsLogProvider {
@NotNull
@Override
public List<? extends VcsFullCommitDetails> readFirstBlock(@NotNull VirtualFile root, boolean ordered) throws VcsException {
public List<? extends VcsFullCommitDetails> readFirstBlock(@NotNull VirtualFile root,
boolean ordered, int commitCount) throws VcsException {
String[] params = { "HEAD", "--branches", "--remotes", "--tags", "--encoding=UTF-8", "--full-history", "--sparse",
"--max-count=" + VcsLogProvider.COMMIT_BLOCK_SIZE};
"--max-count=" + commitCount};
if (ordered) {
params = ArrayUtil.append(params, "--date-order");
}
+5 -4
View File
@@ -8,13 +8,14 @@ includeTargets << new File("${projectHome}/build/scripts/utils.gant")
setProperty("outDir", "${projectHome}/out/python")
setProperty("ideaDir", "${outDir}/ideaCE")
setProperty("ideaHome", "${ideaDir}/jdk16") //compiled idea
setProperty("pluginHelp", "${outDir}/help")
setProperty("buildNumber", requireProperty("build.number", snapshot))
setProperty("ideaBuildNumber", requireProperty("idea.build.number"))
setProperty("ideaHomePacked", "${ideaDir}/jdk16") //compiled idea
setProperty("ideaHome", "${ideaDir}/jdk16/idea-IC-${ideaBuildNumber}") //compiled idea
setProperty("pluginHome", "${projectHome}/python")
setProperty("pluginRevision", "${buildNumber}")
@@ -69,9 +70,9 @@ target(name: "clean", description: "Cleanup output") {
}
target(name: "unzip") {
ant.mkdir(dir: "${ideaHome}")
ant.mkdir(dir: "${ideaHomePacked}")
ant.gunzip(src: "${ideaDir}/ideaIC-${ideaBuildNumber}.tar.gz")
ant.untar(src: "${ideaDir}/ideaIC-${ideaBuildNumber}.tar", dest: "${ideaHome}")
ant.untar(src: "${ideaDir}/ideaIC-${ideaBuildNumber}.tar", dest: "${ideaHomePacked}")
}
target(name: "compile", description: "Compile module python") {