mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VCS: git outgoing provider logging for team city
This commit is contained in:
@@ -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<GitBranch> usedBranches = new HashSet<GitBranch>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user