mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] Add debug logging for start and finish of all Git commands.
Log start in start(), because runInCurrentThread doesn't cover all usages of start() (some history commands are called via start()). Log finish in runInCurrentThread(), because start() is async.
This commit is contained in:
@@ -136,4 +136,8 @@ public class GitCommand {
|
||||
return new GitCommand(this, LockingPolicy.READ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public abstract class GitHandler {
|
||||
private Runnable mySuspendAction; // Suspend action used by {@link #suspendWriteLock()}
|
||||
private Runnable myResumeAction; // Resume action used by {@link #resumeWriteLock()}
|
||||
|
||||
private long myStartTime; // git execution start timestamp
|
||||
|
||||
|
||||
/**
|
||||
* A constructor
|
||||
@@ -387,12 +389,19 @@ public abstract class GitHandler {
|
||||
checkNotStarted();
|
||||
|
||||
try {
|
||||
// setup environment
|
||||
myStartTime = System.currentTimeMillis();
|
||||
if (!myProject.isDefault() && !mySilent && (myVcs != null)) {
|
||||
myVcs.showCommandLine("cd " + myWorkingDirectory);
|
||||
myVcs.showCommandLine(printableCommandLine());
|
||||
LOG.info("cd " + myWorkingDirectory);
|
||||
LOG.info(myCommandLine.getCommandLineString());
|
||||
}
|
||||
else {
|
||||
LOG.debug("cd " + myWorkingDirectory);
|
||||
LOG.debug(myCommandLine.getCommandLineString());
|
||||
}
|
||||
|
||||
// setup environment
|
||||
if (!myNoSSHFlag && myProjectSettings.isIdeaSsh()) {
|
||||
GitSSHService ssh = GitSSHIdeaService.getInstance();
|
||||
myEnv.put(GitSSHHandler.GIT_SSH_ENV, ssh.getScriptPath().getPath());
|
||||
@@ -721,6 +730,13 @@ public abstract class GitHandler {
|
||||
vcs.getCommandLock().writeLock().unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
if (myStartTime > 0) {
|
||||
LOG.debug(String.format("git %s took %s ms", myCommand, System.currentTimeMillis() - myStartTime));
|
||||
}
|
||||
else {
|
||||
LOG.debug(String.format("git %s finished.", myCommand));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user