static void GitGetFiles(string wcRoot, GitStatusSet statusSet) { string git = Git.FindGit(); if (git == null) { return; } ProcessRunner runner = new ProcessRunner(); runner.WorkingDirectory = wcRoot; runner.LogStandardOutputAndError = false; runner.OutputLineReceived += delegate(object sender, LineReceivedEventArgs e) { if (!string.IsNullOrEmpty(e.Line)) { statusSet.AddEntry(e.Line, GitStatus.OK); } }; string command = "ls-files"; bool hasErrors = false; runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { if (!hasErrors) { hasErrors = true; GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); } GitMessageView.AppendLine(e.Line); }; runner.Start(git, command); runner.WaitForExit(); }
static void GitGetFiles(string wcRoot, GitStatusSet statusSet) { string git = Git.FindGit(); if (git == null) { return; } using (ProcessRunner runner = new ProcessRunner()) { runner.WorkingDirectory = DirectoryName.Create(wcRoot); runner.RedirectStandardOutput = true; runner.RedirectStandardError = true; runner.Start(git, "ls-files"); // process stderr in background var errorTask = DisplayErrorStreamAsync(runner, GitMessageView.Category); // process stderr on current thread: using (var reader = runner.OpenStandardOutputReader()) { string line; while ((line = reader.ReadLine()) != null) { if (line.Length > 0) { statusSet.AddEntry(line, GitStatus.OK); } } } errorTask.Wait(); } }
void HandleChanges() { string newHash = GitVersionProvider.GetBlobHashAsync(Git.FindGit(), fileName).Result; if (newHash != hash) { LoggingService.Info(fileName + " was changed!"); callback(this, EventArgs.Empty); } this.hash = newHash; }
public async Task <Stream> OpenBaseVersionAsync(FileName fileName) { if (!Git.IsInWorkingCopy(fileName)) { return(null); } string git = Git.FindGit(); if (git == null) { return(null); } return(OpenOutput(git, fileName, await GetBlobHashAsync(git, fileName).ConfigureAwait(false))); }
public Stream OpenBaseVersion(string fileName) { if (!Git.IsInWorkingCopy(fileName)) { return(null); } string git = Git.FindGit(); if (git == null) { return(null); } return(OpenOutput(git, fileName, GetBlobHash(git, fileName))); }
static void GitGetStatus(string wcRoot, GitStatusSet statusSet) { string git = Git.FindGit(); if (git == null) { return; } string command = "status --porcelain --untracked-files=no"; bool hasErrors = false; ProcessRunner runner = new ProcessRunner(); runner.WorkingDirectory = wcRoot; runner.LogStandardOutputAndError = false; runner.OutputLineReceived += delegate(object sender, LineReceivedEventArgs e) { if (!string.IsNullOrEmpty(e.Line)) { Match m = statusParseRegex.Match(e.Line); if (m.Success) { statusSet.AddEntry(m.Groups[2].Value, StatusFromText(m.Groups[1].Value)); } else { if (!hasErrors) { // in front of first output line, print the command line we invoked hasErrors = true; GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); } GitMessageView.AppendLine("unknown output: " + e.Line); } } }; runner.ErrorLineReceived += delegate(object sender, LineReceivedEventArgs e) { if (!hasErrors) { hasErrors = true; GitMessageView.AppendLine(runner.WorkingDirectory + "> git " + command); } GitMessageView.AppendLine(e.Line); }; runner.Start(git, command); runner.WaitForExit(); }
void SetGitStatus() { string path = AddInOptions.PathToGit; if (path == null) { path = Git.FindGit(); if (path == null) { path = SD.ResourceService.GetString("AddIns.Git.NoPathFoundStatus"); } else { path += Environment.NewLine + SD.ResourceService.GetString("AddIns.Git.PathAutoDetectStatus"); } } status.Text = path; }
public IDisposable WatchBaseVersionChanges(FileName fileName, EventHandler callback) { if (!File.Exists(fileName)) { return(null); } if (!Git.IsInWorkingCopy(fileName)) { return(null); } string git = Git.FindGit(); if (git == null) { return(null); } return(new BaseVersionChangeWatcher(fileName, GetBlobHashAsync(git, fileName).Result, callback)); }
static void GitGetStatus(string wcRoot, GitStatusSet statusSet) { string git = Git.FindGit(); if (git == null) { return; } ProcessRunner runner = new ProcessRunner(); runner.WorkingDirectory = DirectoryName.Create(wcRoot); runner.RedirectStandardOutput = true; runner.RedirectStandardError = true; runner.Start(git, "status", "--porcelain", "--untracked-files=no"); // process stderr in background var errorTask = DisplayErrorStreamAsync(runner, GitMessageView.Category); // process stderr on current thread: using (var reader = runner.OpenStandardOutputReader()) { string line; while ((line = reader.ReadLine()) != null) { if (line.Length > 0) { Match m = statusParseRegex.Match(line); if (m.Success) { statusSet.AddEntry(m.Groups[2].Value, StatusFromText(m.Groups[1].Value)); } else { GitMessageView.AppendLine("unknown git status output: " + line); } } } } errorTask.Wait(); }