From c3a883e308ba77be2b4cc12087059fbf8c676459 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 24 May 2012 15:36:18 +0400 Subject: [PATCH] VcsRoot: make fields private, use @Nullable getters VcsRoot.getVcs() and .getPath() can be null, because they are sometimes created like that. GitRepositoryManagerImpl.getRepositoryForFile: don't log null VCS. --- .../diff/impl/patch/IdeaTextPatchBuilder.java | 6 +-- .../src/com/intellij/openapi/vcs/VcsRoot.java | 37 ++++++++++++------- .../formove/TriggerAdditionOrDeletion.java | 30 +++++++-------- .../openapi/vcs/changes/DirtBuilder.java | 8 ++-- .../openapi/vcs/changes/FilePathUnderVcs.java | 4 +- .../vcs/changes/RemoteRevisionsCache.java | 3 +- .../changes/RemoteRevisionsNumbersCache.java | 12 +++--- .../changes/RemoteRevisionsStateCache.java | 6 +-- .../vcs/changes/VcsDirtyScopeImpl.java | 9 +++-- .../vcs/impl/LocalChangesUnderRoots.java | 7 ++-- .../openapi/vcs/impl/VcsRootIterator.java | 4 +- .../repo/GitRepositoryManagerImpl.java | 10 +++-- .../git4idea/status/GitChangesCollector.java | 2 +- .../src/org/zmlx/hg4idea/util/HgUtil.java | 4 +- 14 files changed, 78 insertions(+), 64 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/IdeaTextPatchBuilder.java b/platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/IdeaTextPatchBuilder.java index 839e94ba8049..3b6b9a034cb0 100644 --- a/platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/IdeaTextPatchBuilder.java +++ b/platform/vcs-api/src/com/intellij/openapi/diff/impl/patch/IdeaTextPatchBuilder.java @@ -52,12 +52,12 @@ public class IdeaTextPatchBuilder { for (VcsRoot root : byRoots.keySet()) { final Collection rootChanges = byRoots.get(root); - if (root.vcs == null || root.vcs.getOutgoingChangesProvider() == null) { + if (root.getVcs() == null || root.getVcs().getOutgoingChangesProvider() == null) { addConvertChanges(rootChanges, result); continue; } - final VcsOutgoingChangesProvider provider = root.vcs.getOutgoingChangesProvider(); - final Collection basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.path); + final VcsOutgoingChangesProvider provider = root.getVcs().getOutgoingChangesProvider(); + final Collection basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.getPath()); rootChanges.removeAll(basedOnLocal); addConvertChanges(rootChanges, result); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRoot.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRoot.java index c05995636b45..771a7e29885a 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRoot.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsRoot.java @@ -17,18 +17,31 @@ package com.intellij.openapi.vcs; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.Nullable; /** * @author yole */ public class VcsRoot { - public final AbstractVcs vcs; - public final VirtualFile path; + + @Nullable private final AbstractVcs myVcs; + @Nullable private final VirtualFile myPath; + private int hashcode; - public VcsRoot(final AbstractVcs vcs, final VirtualFile path) { - this.vcs = vcs; - this.path = path; + public VcsRoot(@Nullable AbstractVcs vcs, @Nullable VirtualFile path) { + myVcs = vcs; + myPath = path; + } + + @Nullable + public AbstractVcs getVcs() { + return myVcs; + } + + @Nullable + public VirtualFile getPath() { + return myPath; } @Override @@ -38,26 +51,22 @@ public class VcsRoot { VcsRoot root = (VcsRoot)o; - if (path != null ? !path.equals(root.path) : root.path != null) return false; - if (vcs != null ? !vcs.getName().equals(root.vcs.getName()) : root.vcs != null) return false; + if (myPath != null ? !myPath.equals(root.myPath) : root.myPath != null) return false; + if (myVcs != null ? !myVcs.equals(root.myVcs) : root.myVcs != null) return false; return true; } - @Override public int hashCode() { if (hashcode == 0) { - hashcode = vcs != null ? vcs.getName().hashCode() : 0; - hashcode = 31 * hashcode + (path != null ? path.hashCode() : 0); + hashcode = myVcs != null ? myVcs.hashCode() : 0; + hashcode = 31 * hashcode + (myPath != null ? myPath.hashCode() : 0); } return hashcode; } @Override public String toString() { - return "VcsRoot{" + - "vcs=" + vcs + - ", path=" + path + - '}'; + return String.format("VcsRoot{vcs=%s, path=%s}", myVcs, myPath); } } \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/TriggerAdditionOrDeletion.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/TriggerAdditionOrDeletion.java index e9a3eec147cd..b74937583127 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/TriggerAdditionOrDeletion.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/TriggerAdditionOrDeletion.java @@ -91,14 +91,14 @@ public class TriggerAdditionOrDeletion { if (myPreparedDeletion != null) { for (Map.Entry> entry : myPreparedDeletion.entrySet()) { final VcsRoot vcsRoot = entry.getKey(); - final CheckinEnvironment localChangesProvider = vcsRoot.vcs.getCheckinEnvironment(); + final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment(); if (localChangesProvider == null) continue; final Collection filePaths = entry.getValue(); - if (vcsRoot.vcs.fileListenerIsSynchronous()) { + if (vcsRoot.getVcs().fileListenerIsSynchronous()) { myAffected.addAll(filePaths); continue; } - askUserIfNeededDeletion(vcsRoot.vcs, (List)filePaths); + askUserIfNeededDeletion(vcsRoot.getVcs(), (List)filePaths); myAffected.addAll(filePaths); localChangesProvider.scheduleMissingFileForDeletion((List)filePaths); } @@ -106,14 +106,14 @@ public class TriggerAdditionOrDeletion { if (myPreparedAddition != null) { for (Map.Entry> entry : myPreparedAddition.entrySet()) { final VcsRoot vcsRoot = entry.getKey(); - final CheckinEnvironment localChangesProvider = vcsRoot.vcs.getCheckinEnvironment(); + final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment(); if (localChangesProvider == null) continue; final Collection filePaths = entry.getValue(); - if (vcsRoot.vcs.fileListenerIsSynchronous()) { + if (vcsRoot.getVcs().fileListenerIsSynchronous()) { myAffected.addAll(filePaths); continue; } - askUserIfNeededAddition(vcsRoot.vcs, (List)filePaths); + askUserIfNeededAddition(vcsRoot.getVcs(), (List)filePaths); myAffected.addAll(filePaths); localChangesProvider.scheduleUnversionedFilesForAddition(ObjectsConvertor.fp2vf(filePaths)); } @@ -128,10 +128,10 @@ public class TriggerAdditionOrDeletion { final MultiMap map = sortByVcsRoots.sort(myDeleted); myPreparedDeletion = new MultiMap(); for (VcsRoot vcsRoot : map.keySet()) { - if (vcsRoot != null && vcsRoot.vcs != null) { - final CheckinEnvironment localChangesProvider = vcsRoot.vcs.getCheckinEnvironment(); + if (vcsRoot != null && vcsRoot.getVcs() != null) { + final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment(); if (localChangesProvider == null) continue; - final boolean takeDirs = vcsRoot.vcs.areDirectoriesVersionedItems(); + final boolean takeDirs = vcsRoot.getVcs().areDirectoriesVersionedItems(); final Collection files = map.get(vcsRoot); final List toBeDeleted = new LinkedList(); @@ -142,7 +142,7 @@ public class TriggerAdditionOrDeletion { } } if (toBeDeleted.isEmpty()) return; - if (! vcsRoot.vcs.fileListenerIsSynchronous()) { + if (! vcsRoot.getVcs().fileListenerIsSynchronous()) { for (FilePath filePath : toBeDeleted) { myVcsFileListenerContextHelper.ignoreDeleted(filePath); } @@ -159,15 +159,15 @@ public class TriggerAdditionOrDeletion { final MultiMap map = sortByVcsRoots.sort(myExisting); myPreparedAddition = new MultiMap(); for (VcsRoot vcsRoot : map.keySet()) { - if (vcsRoot != null && vcsRoot.vcs != null) { - final CheckinEnvironment localChangesProvider = vcsRoot.vcs.getCheckinEnvironment(); + if (vcsRoot != null && vcsRoot.getVcs() != null) { + final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment(); if (localChangesProvider == null) continue; - final boolean takeDirs = vcsRoot.vcs.areDirectoriesVersionedItems(); + final boolean takeDirs = vcsRoot.getVcs().areDirectoriesVersionedItems(); final Collection files = map.get(vcsRoot); final List toBeAdded; if (takeDirs) { - final RecursiveCheckAdder adder = new RecursiveCheckAdder(vcsRoot.path); + final RecursiveCheckAdder adder = new RecursiveCheckAdder(vcsRoot.getPath()); for (FilePath file : files) { adder.process(file); } @@ -184,7 +184,7 @@ public class TriggerAdditionOrDeletion { return; } Collections.sort(toBeAdded, FilePathByPathComparator.getInstance()); - if (! vcsRoot.vcs.fileListenerIsSynchronous()) { + if (! vcsRoot.getVcs().fileListenerIsSynchronous()) { for (FilePath filePath : toBeAdded) { myVcsFileListenerContextHelper.ignoreAdded(filePath.getVirtualFile()); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DirtBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DirtBuilder.java index e67be9520256..aae32d66f9f2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DirtBuilder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DirtBuilder.java @@ -58,13 +58,13 @@ public class DirtBuilder implements DirtBuilderReader { } public void addDirtyFile(final VcsRoot root) { - if (myFileTypeManager.isFileIgnored(root.path.getName())) return; - myFiles.add(new FilePathUnderVcs(new FilePathImpl(root.path), root.vcs)); + if (myFileTypeManager.isFileIgnored(root.getPath().getName())) return; + myFiles.add(new FilePathUnderVcs(new FilePathImpl(root.getPath()), root.getVcs())); } public void addDirtyDirRecursively(final VcsRoot root) { - if (myFileTypeManager.isFileIgnored(root.path.getName())) return; - myDirs.add(new FilePathUnderVcs(new FilePathImpl(root.path), root.vcs)); + if (myFileTypeManager.isFileIgnored(root.getPath().getName())) return; + myDirs.add(new FilePathUnderVcs(new FilePathImpl(root.getPath()), root.getVcs())); } public void addDirtyFile(final FilePathUnderVcs root) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FilePathUnderVcs.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FilePathUnderVcs.java index f3bed0b0a416..c2138f6d25cb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FilePathUnderVcs.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FilePathUnderVcs.java @@ -33,8 +33,8 @@ public class FilePathUnderVcs { } FilePathUnderVcs(final VcsRoot root) { - myPath = new FilePathImpl(root.path); - myVcs = root.vcs; + myPath = new FilePathImpl(root.getPath()); + myVcs = root.getVcs(); } public FilePath getPath() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java index ae5412bdfd9c..b172810d17da 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsCache.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.vcs.changes; -import com.intellij.lifecycle.AtomicSectionsAware; import com.intellij.lifecycle.PeriodicalTasksCloser; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; @@ -128,7 +127,7 @@ public class RemoteRevisionsCache implements PlusMinus final VcsRoot[] roots = myVcsManager.getAllVcsRoots(); synchronized (myLock) { for (VcsRoot root : roots) { - final AbstractVcs vcs = root.vcs; + final AbstractVcs vcs = root.getVcs(); if (! myKinds.containsKey(vcs.getName())) { myKinds.put(vcs.getName(), vcs.getRemoteDifferenceStrategy()); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java index 193d994f90e3..386c5751eb42 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java @@ -96,8 +96,8 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { for (Iterator> iterator = copyMap.entrySet().iterator(); iterator.hasNext();) { final Map.Entry entry = iterator.next(); final VcsRoot key = entry.getKey(); - final boolean backgroundOperationsAllowed = key.vcs.isVcsBackgroundOperationsAllowed(key.path); - LOG.debug("backgroundOperationsAllowed: " + backgroundOperationsAllowed + " for " + key.vcs.getName() + ", " + key.path.getPath()); + final boolean backgroundOperationsAllowed = key.getVcs().isVcsBackgroundOperationsAllowed(key.getPath()); + LOG.debug("backgroundOperationsAllowed: " + backgroundOperationsAllowed + " for " + key.getVcs().getName() + ", " + key.getPath().getPath()); if (! backgroundOperationsAllowed) { iterator.remove(); } @@ -232,7 +232,7 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { //todo check canceled - check VCS's ready for asynchronous queries final VirtualFile vf = myLfs.refreshAndFindFileByIoFile(new File(s)); final ItemLatestState state; - final DiffProvider diffProvider = myVcsRoot.vcs.getDiffProvider(); + final DiffProvider diffProvider = myVcsRoot.getVcs().getDiffProvider(); if (vf == null) { // doesnt matter if directory or not state = diffProvider.getLastRevision(FilePathImpl.createForDeletedFile(new File(s), false)); @@ -262,11 +262,11 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { } public Boolean compute() { - final AbstractVcs vcs = myVcsRoot.vcs; + final AbstractVcs vcs = myVcsRoot.getVcs(); // won't be called in parallel for same vcs -> just synchronized map is ok final String vcsName = vcs.getName(); - LOG.debug("should update for: " + vcsName + " root: " + myVcsRoot.path.getPath()); - final VcsRevisionNumber latestNew = vcs.getDiffProvider().getLatestCommittedRevision(myVcsRoot.path); + LOG.debug("should update for: " + vcsName + " root: " + myVcsRoot.getPath().getPath()); + final VcsRevisionNumber latestNew = vcs.getDiffProvider().getLatestCommittedRevision(myVcsRoot.getPath()); final VcsRevisionNumber latestKnown = myLatestRevisionsMap.get(vcsName); // not known diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsStateCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsStateCache.java index da6934f82e05..fd8a5372242a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsStateCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsStateCache.java @@ -135,12 +135,12 @@ public class RemoteRevisionsStateCache implements ChangesOnServerTracker { for (VcsRoot vcsRoot : dirty.keySet()) { // todo - actually it means nothing since the only known VCS to use this scheme is Git and now it always allow // todo - background operations. when it changes, develop more flexible behavior here - if (! vcsRoot.vcs.isVcsBackgroundOperationsAllowed(vcsRoot.path)) continue; - final TreeDiffProvider provider = vcsRoot.vcs.getTreeDiffProvider(); + if (! vcsRoot.getVcs().isVcsBackgroundOperationsAllowed(vcsRoot.getPath())) continue; + final TreeDiffProvider provider = vcsRoot.getVcs().getTreeDiffProvider(); if (provider == null) continue; final Collection paths = dirty.get(vcsRoot); - final Collection remotelyChanged = provider.getRemotelyChanged(vcsRoot.path, paths); + final Collection remotelyChanged = provider.getRemotelyChanged(vcsRoot.getPath(), paths); for (String path : paths) { results.put(path, new Pair(remotelyChanged.contains(path), vcsRoot)); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java index 97f9e623dbcc..fcdd21c64d16 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java @@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; import com.intellij.util.Processor; @@ -307,16 +308,16 @@ public class VcsDirtyScopeImpl extends VcsModifiableDirtyScope { if (myProject.isDisposed()) return Boolean.FALSE; final VcsRoot rootObject = myVcsManager.getVcsRootObjectFor(path); if (vcsConsumer != null && rootObject != null) { - vcsConsumer.consume(rootObject.vcs); + vcsConsumer.consume(rootObject.getVcs()); } - if (rootObject == null || rootObject.vcs != myVcs) { + if (rootObject == null || rootObject.getVcs() != myVcs) { return Boolean.FALSE; } - final VirtualFile vcsRoot = rootObject.path; + final VirtualFile vcsRoot = rootObject.getPath(); if (vcsRoot != null) { for (VirtualFile contentRoot : myAffectedContentRoots) { - if (VfsUtil.isAncestor(contentRoot, vcsRoot, false)) { + if (VfsUtilCore.isAncestor(contentRoot, vcsRoot, false)) { THashSet dirsByRoot = myDirtyDirectoriesRecursively.get(contentRoot); if (dirsByRoot != null) { for (FilePath filePath : dirsByRoot) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LocalChangesUnderRoots.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LocalChangesUnderRoots.java index eeba391dd2e8..3412cdb4f57c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LocalChangesUnderRoots.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LocalChangesUnderRoots.java @@ -24,6 +24,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.ChangesUtil; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -87,9 +88,9 @@ public class LocalChangesUnderRoots { } VirtualFile rootCandidate = null; for (VcsRoot root : myRoots) { - if (VfsUtil.isAncestor(root.path, vf, false)) { - if (rootCandidate == null || VfsUtil.isAncestor(rootCandidate, root.path, true)) { // in the case of nested roots choose the closest root - rootCandidate = root.path; + if (VfsUtilCore.isAncestor(root.getPath(), vf, false)) { + if (rootCandidate == null || VfsUtil.isAncestor(rootCandidate, root.getPath(), true)) { // in the case of nested roots choose the closest root + rootCandidate = root.getPath(); } } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java index c272b36ad3a3..d580acbb176b 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsRootIterator.java @@ -92,8 +92,8 @@ public class VcsRootIterator { final String ourPath = myRoot.getUrl(); for (VcsRoot root : allRoots) { - if (Comparing.equal(root.vcs.getName(), myVcsName)) continue; - final String url = root.path.getUrl(); + if (Comparing.equal(root.getVcs().getName(), myVcsName)) continue; + final String url = root.getPath().getUrl(); if (url.startsWith(ourPath)) { myExcludedByOtherVcss.add(url); } diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryManagerImpl.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryManagerImpl.java index b853317890af..c266d7e185a1 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepositoryManagerImpl.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryManagerImpl.java @@ -100,12 +100,16 @@ public class GitRepositoryManagerImpl extends AbstractProjectComponent implement public GitRepository getRepositoryForFile(@NotNull VirtualFile file) { final VcsRoot vcsRoot = myVcsManager.getVcsRootObjectFor(file); if (vcsRoot == null) { return null; } - final AbstractVcs vcs = vcsRoot.vcs; + final AbstractVcs vcs = vcsRoot.getVcs(); if (!myVcs.equals(vcs)) { - LOG.info(String.format("getRepositoryForFile returned non-Git (%s) root for file %s", vcs != null ? vcs.getDisplayName() : vcs, file)); + if (vcs != null) { + // if null, the file is just not under version control, nothing interesting; + // otherwise log, because Git method is requested not for a Git-controlled file + LOG.info(String.format("getRepositoryForFile returned non-Git (%s) root for file %s", vcs.getDisplayName(), file)); + } return null; } - return getRepositoryForRoot(vcsRoot.path); + return getRepositoryForRoot(vcsRoot.getPath()); } @Override diff --git a/plugins/git4idea/src/git4idea/status/GitChangesCollector.java b/plugins/git4idea/src/git4idea/status/GitChangesCollector.java index 0d7869471475..df204a34f5a2 100644 --- a/plugins/git4idea/src/git4idea/status/GitChangesCollector.java +++ b/plugins/git4idea/src/git4idea/status/GitChangesCollector.java @@ -114,7 +114,7 @@ abstract class GitChangesCollector { protected void addToPaths(FilePath pathToAdd, List paths) { VcsRoot fileRoot = myVcsManager.getVcsRootObjectFor(pathToAdd); - if (fileRoot != null && fileRoot.vcs != null && fileRoot.vcs.equals(myVcs) && myVcsRoot.equals(fileRoot.path)) { + if (fileRoot != null && fileRoot.getVcs() != null && myVcs.equals(fileRoot.getVcs()) && myVcsRoot.equals(fileRoot.getPath())) { paths.add(pathToAdd.getPath()); } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java index 35c3ef69e993..ecceca01bfe8 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java @@ -332,8 +332,8 @@ public abstract class HgUtil { public static @NotNull List getHgRepositories(@NotNull Project project) { final List repos = new LinkedList(); for (VcsRoot root : ProjectLevelVcsManager.getInstance(project).getAllVcsRoots()) { - if (HgVcs.VCS_NAME.equals(root.vcs.getName())) { - repos.add(root.path); + if (HgVcs.VCS_NAME.equals(root.getVcs().getName())) { + repos.add(root.getPath()); } } return repos;