From 787aedd70487580a2cd3c296e60c1dfa343180d2 Mon Sep 17 00:00:00 2001 From: Irina Chernushina Date: Thu, 10 Sep 2009 15:35:01 +0400 Subject: [PATCH] VCS: git outgoing provider logging for team city --- plugins/git4idea/src/git4idea/GitBranchesSearcher.java | 15 +++++++++++++-- plugins/git4idea/src/git4idea/GitUtil.java | 3 +++ .../src/git4idea/changes/GitOutgoingChangesProvider.java | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitBranchesSearcher.java b/plugins/git4idea/src/git4idea/GitBranchesSearcher.java index 369f4c6fc2..8b33d449a6 100644 --- a/plugins/git4idea/src/git4idea/GitBranchesSearcher.java +++ b/plugins/git4idea/src/git4idea/GitBranchesSearcher.java @@ -16,6 +16,7 @@ package git4idea; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.VirtualFile; @@ -24,26 +25,36 @@ import java.util.HashSet; import java.util.Set; public class GitBranchesSearcher { + private final static Logger LOG = Logger.getInstance("#git4idea.GitBranchesSearcher"); private GitBranch myLocal; private GitBranch myRemote; public GitBranchesSearcher(final Project project, final VirtualFile root, final boolean findRemote) throws VcsException { + LOG.debug("constructing, root: " + root.getPath() + " findRemote = " + findRemote); final Set usedBranches = new HashSet(); myLocal = GitBranch.current(project, root); + LOG.debug("local: " + myLocal); if (myLocal == null) return; usedBranches.add(myLocal); GitBranch remote = myLocal; while (true) { remote = remote.tracked(project, root); - if (remote == null) return; + if (remote == null) { + LOG.debug("remote == null, exiting"); + return; + } if ((! findRemote) || remote.isRemote()) { + LOG.debug("remote found, isRemote: " + remote.isRemote() + " remoteName: " + remote.getFullName()); myRemote = remote; return; } - if (usedBranches.contains(remote)) return; + if (usedBranches.contains(remote)) { + LOG.debug("loop found for: " + remote.getFullName() + ", exiting"); + return; + } usedBranches.add(remote); } } diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index f2f2e405ac..f0ef2f9562 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -19,6 +19,7 @@ package git4idea; * This code was originally derived from the MKS & Mercurial IDEA VCS plugins */ +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; @@ -48,6 +49,7 @@ import java.util.*; * Git utility/helper methods */ public class GitUtil { + private final static Logger LOG = Logger.getInstance("#git4idea.GitUtil"); /** * A private constructor to suppress instance creation @@ -637,6 +639,7 @@ public class GitUtil { parametersSpecifier.consume(h); String output = h.run(); + LOG.debug("getLocalCommittedChanges output: '" + output + "'"); StringScanner s = new StringScanner(output); while (s.hasMoreData() && s.startsWith('\u000C')) { s.nextLine(); diff --git a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java index 426d2f98b3..f4949de801 100644 --- a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java +++ b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java @@ -1,5 +1,6 @@ package git4idea.changes; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsOutgoingChangesProvider; @@ -13,6 +14,7 @@ import java.util.Collections; import java.util.List; public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider { + private final static Logger LOG = Logger.getInstance("#git4idea.changes.GitOutgoingChangesProvider"); private final Project myProject; public GitOutgoingChangesProvider(Project project) { @@ -20,6 +22,7 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider { } public List getOutgoingChanges(final VirtualFile vcsRoot, final boolean findRemote) throws VcsException { + LOG.debug("getOutgoingChanges root: " + vcsRoot.getPath()); final GitBranchesSearcher searcher = new GitBranchesSearcher(myProject, vcsRoot, findRemote); if (searcher.getLocal() == null || searcher.getRemote() == null) return Collections.emptyList(); -- 2.11.4.GIT