From 05f0d8d7fa1e976a1498e842ee4b7b0dda25f7d2 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 27 Mar 2017 11:42:52 +0100 Subject: [PATCH] Record the time spend on reading repo info from .git --- plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java index 120de4a54dee..08a41b25f19e 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryImpl.java @@ -15,6 +15,7 @@ */ package git4idea.repo; +import com.intellij.dvcs.DvcsUtil; import com.intellij.dvcs.repo.RepositoryImpl; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; @@ -22,6 +23,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.vcs.log.util.StopWatch; import git4idea.GitLocalBranch; import git4idea.GitUtil; import git4idea.GitVcs; @@ -32,6 +34,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.util.Collection; +import static com.intellij.dvcs.DvcsUtil.getShortRepositoryName; import static com.intellij.util.ObjectUtils.assertNotNull; public class GitRepositoryImpl extends RepositoryImpl implements GitRepository { @@ -202,12 +205,14 @@ public class GitRepositoryImpl extends RepositoryImpl implements GitRepository { @NotNull private GitRepoInfo readRepoInfo() { + StopWatch sw = StopWatch.start("Reading Git repo info in " + getShortRepositoryName(this)); File configFile = myRepositoryFiles.getConfigFile(); GitConfig config = GitConfig.read(configFile); Collection remotes = config.parseRemotes(); GitBranchState state = myReader.readState(remotes); Collection trackInfos = config.parseTrackInfos(state.getLocalBranches().keySet(), state.getRemoteBranches().keySet()); Collection submodules = new GitModulesFileReader().read(getSubmoduleFile()); + sw.report(); return new GitRepoInfo(state.getCurrentBranch(), state.getCurrentRevision(), state.getState(), remotes, state.getLocalBranches(), state.getRemoteBranches(), trackInfos, submodules); }