diff --git a/platform/vcs-log/impl/src/META-INF/vcs-log.xml b/platform/vcs-log/impl/src/META-INF/vcs-log.xml
index 377cc00e3f89..6f85187e620c 100644
--- a/platform/vcs-log/impl/src/META-INF/vcs-log.xml
+++ b/platform/vcs-log/impl/src/META-INF/vcs-log.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java
index e01959177aac..dcb862fc0c13 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogDataHolder.java
@@ -16,6 +16,7 @@
package com.intellij.vcs.log.data;
import com.intellij.openapi.Disposable;
+import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Attachment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.BackgroundTaskQueue;
@@ -154,7 +155,7 @@ public class VcsLogDataHolder implements Disposable {
*/
private CountDownLatch myEntireLogLoadWaiter;
- public VcsLogDataHolder(@NotNull Project project, @NotNull VcsLogObjectsFactory logObjectsFactory,
+ public VcsLogDataHolder(@NotNull Project project,
@NotNull Map logProviders, @NotNull VcsLogSettings settings) {
myProject = project;
myLogProviders = logProviders;
@@ -163,7 +164,7 @@ public class VcsLogDataHolder implements Disposable {
myDetailsGetter = new CommitDetailsGetter(this, logProviders);
myLogJoiner = new VcsLogJoiner();
myMultiRepoJoiner = new VcsLogMultiRepoJoiner();
- myFactory = logObjectsFactory;
+ myFactory = ServiceManager.getService(myProject, VcsLogObjectsFactory.class);
mySettings = settings;
}
@@ -178,10 +179,10 @@ public class VcsLogDataHolder implements Disposable {
* @param settings
* @param onInitialized This is called when the holder is initialized with the initial data received from the VCS.
*/
- public static void init(@NotNull final Project project, @NotNull VcsLogObjectsFactory logObjectsFactory,
+ public static void init(@NotNull final Project project,
@NotNull Map logProviders,
@NotNull VcsLogSettings settings, @NotNull final Consumer onInitialized) {
- final VcsLogDataHolder dataHolder = new VcsLogDataHolder(project, logObjectsFactory, logProviders, settings);
+ final VcsLogDataHolder dataHolder = new VcsLogDataHolder(project, logProviders, settings);
dataHolder.initialize(onInitialized);
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogManager.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogManager.java
index ab2eeccd5164..0c9e6aef9006 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogManager.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogManager.java
@@ -20,7 +20,6 @@ import com.intellij.ui.content.ContentManagerEvent;
import com.intellij.util.Consumer;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
-import com.intellij.vcs.log.VcsLogObjectsFactory;
import com.intellij.vcs.log.VcsLogProvider;
import com.intellij.vcs.log.VcsLogRefresher;
import com.intellij.vcs.log.VcsLogSettings;
@@ -45,7 +44,6 @@ public class VcsLogManager implements Disposable {
@NotNull private final Project myProject;
@NotNull private final ProjectLevelVcsManager myVcsManager;
- @NotNull private final VcsLogObjectsFactory myLogObjectsFactory;
@NotNull private final VcsLogSettings mySettings;
@NotNull private final VcsLogUiProperties myUiProperties;
@@ -54,11 +52,10 @@ public class VcsLogManager implements Disposable {
private VcsLogUI myUi;
public VcsLogManager(@NotNull Project project, @NotNull ProjectLevelVcsManager vcsManager,
- @NotNull VcsLogObjectsFactory logObjectsFactory, @NotNull VcsLogSettings settings,
+ @NotNull VcsLogSettings settings,
@NotNull VcsLogUiProperties uiProperties) {
myProject = project;
myVcsManager = vcsManager;
- myLogObjectsFactory = logObjectsFactory;
mySettings = settings;
myUiProperties = uiProperties;
Disposer.register(myProject, this);
@@ -69,7 +66,7 @@ public class VcsLogManager implements Disposable {
final Map logProviders = findLogProviders();
final VcsLogContainer mainPanel = new VcsLogContainer(myProject);
- VcsLogDataHolder.init(myProject, myLogObjectsFactory, logProviders, mySettings, new Consumer() {
+ VcsLogDataHolder.init(myProject, logProviders, mySettings, new Consumer() {
@Override
public void consume(VcsLogDataHolder vcsLogDataHolder) {
Disposer.register(VcsLogManager.this, vcsLogDataHolder);
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogObjectsFactoryImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogObjectsFactoryImpl.java
index 6ea9810a3bf0..c3c4d6ff0d28 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogObjectsFactoryImpl.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogObjectsFactoryImpl.java
@@ -12,6 +12,12 @@ import java.util.List;
*/
public class VcsLogObjectsFactoryImpl implements VcsLogObjectsFactory {
+ @NotNull private final VcsLogManager myLogManager;
+
+ public VcsLogObjectsFactoryImpl(@NotNull VcsLogManager logManager) {
+ myLogManager = logManager;
+ }
+
@NotNull
@Override
public Hash createHash(@NotNull String stringHash) {
diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java
index 705e86169847..41bb56105703 100644
--- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java
+++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java
@@ -198,7 +198,7 @@ public class GitCherryPickAction extends DumbAwareAction {
return ContainerUtil.map(commits, new Function() {
@Override
public VcsFullCommitDetails fun(GitHeavyCommit commit) {
- final VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ final VcsLogObjectsFactory factory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
List parents = ContainerUtil.map(commit.getParentsHashes(), new Function() {
@Override
public Hash fun(String hashValue) {
diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
index d51f4765abce..85a0eaeb2681 100644
--- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
+++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
@@ -535,7 +535,7 @@ public class GitHistoryUtils {
}
@NotNull
- public static List readAllHashes(@NotNull Project project, @NotNull VirtualFile root) throws VcsException {
+ public static List readAllHashes(@NotNull final Project project, @NotNull VirtualFile root) throws VcsException {
final int COMMIT_BUFFER = 1000;
GitLineHandler h = new GitLineHandler(project, root, GitCommand.LOG);
@@ -571,7 +571,7 @@ public class GitHistoryUtils {
afterParseRemainder = line.substring(recordEnd + 1);
}
if (afterParseRemainder != null && records.incrementAndGet() > COMMIT_BUFFER) { // null means can't parse now
- commits.addAll(parseCommit(parser, record));
+ commits.addAll(parseCommit(project, parser, record));
record.setLength(0);
record.append(afterParseRemainder);
}
@@ -584,7 +584,7 @@ public class GitHistoryUtils {
@Override
public void processTerminated(int exitCode) {
try {
- commits.addAll(parseCommit(parser, record));
+ commits.addAll(parseCommit(project, parser, record));
}
catch (Exception e) {
ex.set(new VcsException(e));
@@ -603,19 +603,19 @@ public class GitHistoryUtils {
return commits;
}
- private static List parseCommit(GitLogParser parser, StringBuilder record) {
+ private static List parseCommit(final Project project, GitLogParser parser, StringBuilder record) {
List rec = parser.parse(record.toString());
return ContainerUtil.mapNotNull(rec, new Function() {
@Override
public TimedVcsCommit fun(GitLogRecord record) {
- return record == null ? null : convert(record);
+ return (record == null) ? null : convert(project, record);
}
});
}
@NotNull
- private static TimedVcsCommit convert(GitLogRecord rec) {
- VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ private static TimedVcsCommit convert(Project project, GitLogRecord rec) {
+ VcsLogObjectsFactory factory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
List parents = ContainerUtil.map(rec.getParentsHashes(), new Function() {
@Override
public Hash fun(String s) {
diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java
index 1f3e7230f34d..ada97bbf8a25 100644
--- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java
+++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java
@@ -66,7 +66,7 @@ public class GitLogProvider implements VcsLogProvider {
myProject = project;
myRepositoryManager = repositoryManager;
myRefSorter = new GitRefManager(myRepositoryManager);
- myVcsObjectsFactory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ myVcsObjectsFactory = ServiceManager.getService(myProject, VcsLogObjectsFactory.class);
}
@NotNull
diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java b/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
index f7504275d9df..5e220695dc20 100644
--- a/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
+++ b/plugins/git4idea/test-stepdefs/git4idea/GitCherryPickStepdefs.java
@@ -262,7 +262,7 @@ public class GitCherryPickStepdefs {
private static VcsFullCommitDetails mockCommit(String hash, String message) {
List changes = new ArrayList();
changes.add(new Change(null, new MockContentRevision(new FilePathImpl(new MockVirtualFile("name")), VcsRevisionNumber.NULL)));
- return ServiceManager.getService(VcsLogObjectsFactory.class).createFullDetails(
+ return ServiceManager.getService(myProject, VcsLogObjectsFactory.class).createFullDetails(
HashImpl.build(hash), Collections.emptyList(), 0, NullVirtualFile.INSTANCE, message, "John Smith", "john@mail.com", message,
"John Smith", "john@mail.com", 0, changes, GitContentRevisionFactory.getInstance(myProject));
}
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserFromLogAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserFromLogAction.java
index 7b3d9a1b8c3e..d2437e67cf48 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserFromLogAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShowCommitInBrowserFromLogAction.java
@@ -70,7 +70,7 @@ public class GithubShowCommitInBrowserFromLogAction extends GithubShowCommitInBr
private static VcsShortCommitDetails getCurrentlySelectedCommitInTheLog(AnActionEvent e) {
GitHeavyCommit heavyCommit = e.getData(GitVcs.GIT_COMMIT);
if (heavyCommit != null) {
- final VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ final VcsLogObjectsFactory factory = ServiceManager.getService(e.getProject(), VcsLogObjectsFactory.class);
List parents = ContainerUtil.map(heavyCommit.getParentsHashes(), new Function() {
@Override
public Hash fun(String s) {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
index e8f170bba3c4..4b4fbc3424ca 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
@@ -62,7 +62,7 @@ public class HgLogProvider implements VcsLogProvider {
myProject = project;
myRepositoryManager = repositoryManager;
myRefSorter = new HgRefManager();
- myVcsObjectsFactory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ myVcsObjectsFactory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
}
@NotNull
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryImpl.java b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryImpl.java
index 740df7d22b62..bafc447b7625 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryImpl.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryImpl.java
@@ -51,7 +51,7 @@ public class HgRepositoryImpl extends RepositoryImpl implements HgRepository {
super(project, rootDir, parentDisposable);
myHgDir = rootDir.findChild(HgUtil.DOT_HG);
assert myHgDir != null : ".hg directory wasn't found under " + rootDir.getPresentableUrl();
- myReader = new HgRepositoryReader(VfsUtilCore.virtualToIoFile(myHgDir));
+ myReader = new HgRepositoryReader(project, VfsUtilCore.virtualToIoFile(myHgDir));
myConfig = HgConfig.getInstance(project, rootDir);
update();
}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java
index 39524ad46e28..aaf7fb58e0eb 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/repo/HgRepositoryReader.java
@@ -19,6 +19,7 @@ import com.intellij.dvcs.repo.RepoStateException;
import com.intellij.dvcs.repo.Repository;
import com.intellij.dvcs.repo.RepositoryUtil;
import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
import com.intellij.vcs.log.VcsLogObjectsFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,7 +50,7 @@ public class HgRepositoryReader {
@NotNull private final File myLocalTagsFile; // .hg/localtags
@NotNull private final VcsLogObjectsFactory myVcsObjectsFactory;
- public HgRepositoryReader(@NotNull File hgDir) {
+ public HgRepositoryReader(@NotNull Project project, @NotNull File hgDir) {
myHgDir = hgDir;
RepositoryUtil.assertFileExists(myHgDir, ".hg directory not found in " + myHgDir);
File branchesFile = new File(new File(myHgDir, "cache"), "branchheads-served"); //branchheads-served exist after mercurial 2.5,
@@ -60,7 +61,7 @@ public class HgRepositoryReader {
myCurrentBookmark = new File(myHgDir, "bookmarks.current");
myLocalTagsFile = new File(myHgDir, "localtags");
myTagsFile = new File(myHgDir.getParentFile(), ".hgtags");
- myVcsObjectsFactory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ myVcsObjectsFactory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
}
/**
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgHistoryUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgHistoryUtil.java
index 487355820b9a..cfc8a33e1181 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgHistoryUtil.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgHistoryUtil.java
@@ -120,7 +120,7 @@ public class HgHistoryUtil {
@NotNull
public static List extends VcsShortCommitDetails> readMiniDetails(Project project, final VirtualFile root, List hashes)
throws VcsException {
- final VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ final VcsLogObjectsFactory factory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
return ContainerUtil.map(getCommittedChangeList(project, root, -1, false, prepareHashes(hashes)),
new Function() {
@Override
@@ -140,7 +140,7 @@ public class HgHistoryUtil {
@NotNull
public static List readAllHashes(@NotNull Project project, @NotNull VirtualFile root) throws VcsException {
- final VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ final VcsLogObjectsFactory factory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
return ContainerUtil.map(getCommittedChangeList(project, root, -1, false, ""), new Function() {
@Override
public TimedVcsCommit fun(HgCommittedChangeList record) {
@@ -174,7 +174,7 @@ public class HgHistoryUtil {
private static VcsFullCommitDetails createCommit(@NotNull Project project, @NotNull VirtualFile root,
@NotNull HgCommittedChangeList record) {
- final VcsLogObjectsFactory factory = ServiceManager.getService(VcsLogObjectsFactory.class);
+ final VcsLogObjectsFactory factory = ServiceManager.getService(project, VcsLogObjectsFactory.class);
HgRevisionNumber revNumber = (HgRevisionNumber)record.getRevisionNumber();
List parents = ContainerUtil.map(revNumber.getParents(), new Function() {
diff --git a/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRealRepositoryReaderTest.java b/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRealRepositoryReaderTest.java
index 73a1a58e28b8..079a6d265268 100644
--- a/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRealRepositoryReaderTest.java
+++ b/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRealRepositoryReaderTest.java
@@ -41,7 +41,7 @@ public class HgRealRepositoryReaderTest extends HgPlatformTest {
File hgDir = new File(myRepository.getPath(), ".hg");
assertTrue(hgDir.exists());
createBranchesAndTags();
- myRepositoryReader = new HgRepositoryReader(hgDir);
+ myRepositoryReader = new HgRepositoryReader(myProject, hgDir);
}
public void testMergeState() {
diff --git a/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRepositoryReaderTest.java b/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRepositoryReaderTest.java
index c7bc0f517f4d..bb94270fce05 100644
--- a/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRepositoryReaderTest.java
+++ b/plugins/hg4idea/testSrc/hg4idea/test/repo/HgRepositoryReaderTest.java
@@ -63,7 +63,7 @@ public class HgRepositoryReaderTest extends HgPlatformTest {
FileUtil.copy(testTagFile, new File(myHgDir.getParentFile(), ".hgtags"));
FileUtil.copy(testLocalTagFile, new File(myHgDir, "localtags"));
- myRepositoryReader = new HgRepositoryReader(myHgDir);
+ myRepositoryReader = new HgRepositoryReader(myProject, myHgDir);
myBranches = readBranches();
myBookmarks = readRefs(testBookmarkFile);
myTags = readRefs(testTagFile);