From 3c8c2f559e4b130e5b3d685f0b742507fda027ff Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 7 Jul 2014 16:30:46 +0400 Subject: [PATCH] [git] more diagnostics for the problem when change is not found for file --- plugins/git4idea/src/git4idea/GitUtil.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index 5589b2a3b4ef..4286aee1536b 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -34,6 +34,7 @@ import com.intellij.openapi.vcs.ProjectLevelVcsManager; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeListManager; +import com.intellij.openapi.vcs.changes.ChangeListManagerEx; import com.intellij.openapi.vcs.changes.FilePathsHelper; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import com.intellij.openapi.vcs.vfs.AbstractVcsVirtualFile; @@ -976,17 +977,22 @@ public class GitUtil { @NotNull public static List findLocalChangesForPaths(@NotNull Project project, @NotNull VirtualFile root, @NotNull Collection affectedPaths, boolean relativePaths) { + ChangeListManagerEx changeListManager = (ChangeListManagerEx)ChangeListManager.getInstance(project); List affectedChanges = new ArrayList(); for (String path : affectedPaths) { String absolutePath = relativePaths ? toAbsolute(root, path) : path; VirtualFile file = findRefreshFileOrLog(absolutePath); if (file != null) { - Change change = ChangeListManager.getInstance(project).getChange(file); + Change change = changeListManager.getChange(file); if (change != null) { affectedChanges.add(change); } else { - LOG.warn("Change is not found for " + file.getPath()); + String message = "Change is not found for " + file.getPath(); + if (changeListManager.isInUpdate()) { + message += " because ChangeListManager is being updated."; + } + LOG.warn(message); } } }