|
|
@ -63,6 +63,10 @@ namespace ICSharpCode.GitAddIn |
|
|
|
|
|
|
|
|
|
|
|
static void GitGetFiles(string wcRoot, GitStatusSet statusSet) |
|
|
|
static void GitGetFiles(string wcRoot, GitStatusSet statusSet) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
string git = Git.FindGit(); |
|
|
|
|
|
|
|
if (git == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
ProcessRunner runner = new ProcessRunner(); |
|
|
|
ProcessRunner runner = new ProcessRunner(); |
|
|
|
runner.WorkingDirectory = wcRoot; |
|
|
|
runner.WorkingDirectory = wcRoot; |
|
|
|
runner.LogStandardOutputAndError = false; |
|
|
|
runner.LogStandardOutputAndError = false; |
|
|
@ -72,41 +76,41 @@ namespace ICSharpCode.GitAddIn |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
string command = "git ls-files"; |
|
|
|
string command = "ls-files"; |
|
|
|
bool hasErrors = false; |
|
|
|
bool hasErrors = false; |
|
|
|
runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
if (!hasErrors) { |
|
|
|
if (!hasErrors) { |
|
|
|
hasErrors = true; |
|
|
|
hasErrors = true; |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> " + command); |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); |
|
|
|
} |
|
|
|
} |
|
|
|
GitMessageView.AppendLine(e.Line); |
|
|
|
GitMessageView.AppendLine(e.Line); |
|
|
|
}; |
|
|
|
}; |
|
|
|
runner.Start("cmd", "/c " + command); |
|
|
|
runner.Start(git, command); |
|
|
|
runner.WaitForExit(); |
|
|
|
runner.WaitForExit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void GitGetStatus(string wcRoot, GitStatusSet statusSet) |
|
|
|
static void GitGetStatus(string wcRoot, GitStatusSet statusSet) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string command = "git status --porcelain --untracked-files=no"; |
|
|
|
string git = Git.FindGit(); |
|
|
|
|
|
|
|
if (git == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string command = "status --porcelain --untracked-files=no"; |
|
|
|
bool hasErrors = false; |
|
|
|
bool hasErrors = false; |
|
|
|
|
|
|
|
|
|
|
|
ProcessRunner runner = new ProcessRunner(); |
|
|
|
ProcessRunner runner = new ProcessRunner(); |
|
|
|
runner.WorkingDirectory = wcRoot; |
|
|
|
runner.WorkingDirectory = wcRoot; |
|
|
|
runner.LogStandardOutputAndError = false; |
|
|
|
runner.LogStandardOutputAndError = false; |
|
|
|
string commandPrompt = wcRoot + ">@"; // C:\work\SD>@git.exe %*
|
|
|
|
|
|
|
|
runner.OutputLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
runner.OutputLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
if (!string.IsNullOrEmpty(e.Line)) { |
|
|
|
if (!string.IsNullOrEmpty(e.Line)) { |
|
|
|
Match m = statusParseRegex.Match(e.Line); |
|
|
|
Match m = statusParseRegex.Match(e.Line); |
|
|
|
if (m.Success) { |
|
|
|
if (m.Success) { |
|
|
|
statusSet.AddEntry(m.Groups[2].Value, StatusFromText(m.Groups[1].Value)); |
|
|
|
statusSet.AddEntry(m.Groups[2].Value, StatusFromText(m.Groups[1].Value)); |
|
|
|
} else if (!e.Line.StartsWith(commandPrompt, StringComparison.Ordinal)) { |
|
|
|
} else { |
|
|
|
// Suppress "unknown output" produced by git.cmd when git is installed
|
|
|
|
|
|
|
|
// in the PATH but the git unix tools aren't
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!hasErrors) { |
|
|
|
if (!hasErrors) { |
|
|
|
// in front of first output line, print the command line we invoked
|
|
|
|
// in front of first output line, print the command line we invoked
|
|
|
|
hasErrors = true; |
|
|
|
hasErrors = true; |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> " + command); |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); |
|
|
|
} |
|
|
|
} |
|
|
|
GitMessageView.AppendLine("unknown output: " + e.Line); |
|
|
|
GitMessageView.AppendLine("unknown output: " + e.Line); |
|
|
|
} |
|
|
|
} |
|
|
@ -115,11 +119,11 @@ namespace ICSharpCode.GitAddIn |
|
|
|
runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { |
|
|
|
if (!hasErrors) { |
|
|
|
if (!hasErrors) { |
|
|
|
hasErrors = true; |
|
|
|
hasErrors = true; |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> " + command); |
|
|
|
GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); |
|
|
|
} |
|
|
|
} |
|
|
|
GitMessageView.AppendLine(e.Line); |
|
|
|
GitMessageView.AppendLine(e.Line); |
|
|
|
}; |
|
|
|
}; |
|
|
|
runner.Start("cmd", "/c " + command); |
|
|
|
runner.Start(git, command); |
|
|
|
runner.WaitForExit(); |
|
|
|
runner.WaitForExit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|