mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-13 06:35:00 +00:00
Compare commits
No commits in common. "12d2b7721c83fb971ae0fbbf02dfea639f9f9825" and "1dfb629cef04619986bb9b624bfe224a7d49d1a7" have entirely different histories.
12d2b7721c
...
1dfb629cef
3 changed files with 4 additions and 10 deletions
|
@ -27,7 +27,7 @@ namespace SourceGit.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public static void RunAndWait(string repo, string file, string args, Models.ICommandLog log)
|
||||
public static void RunAndWait(string repo, string file, string args, Action<string> outputHandler)
|
||||
{
|
||||
var start = new ProcessStartInfo();
|
||||
start.FileName = file;
|
||||
|
@ -40,22 +40,20 @@ namespace SourceGit.Commands
|
|||
start.StandardErrorEncoding = Encoding.UTF8;
|
||||
start.WorkingDirectory = repo;
|
||||
|
||||
log?.AppendLine($"$ {file} {args}\n");
|
||||
|
||||
var proc = new Process() { StartInfo = start };
|
||||
var builder = new StringBuilder();
|
||||
|
||||
proc.OutputDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
log?.AppendLine(e.Data);
|
||||
outputHandler?.Invoke(e.Data);
|
||||
};
|
||||
|
||||
proc.ErrorDataReceived += (_, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
{
|
||||
log?.AppendLine(e.Data);
|
||||
outputHandler?.Invoke(e.Data);
|
||||
builder.AppendLine(e.Data);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -417,7 +417,6 @@ namespace SourceGit.Models
|
|||
|
||||
public void PushCommitMessage(string message)
|
||||
{
|
||||
message = message.Trim().ReplaceLineEndings("\n");
|
||||
var existIdx = CommitMessages.IndexOf(message);
|
||||
if (existIdx == 0)
|
||||
return;
|
||||
|
|
|
@ -36,16 +36,13 @@ namespace SourceGit.ViewModels
|
|||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = "Run custom action ...";
|
||||
|
||||
var log = _repo.CreateLog(CustomAction.Name);
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (CustomAction.WaitForExit)
|
||||
Commands.ExecuteCustomAction.RunAndWait(_repo.FullPath, CustomAction.Executable, _args, log);
|
||||
Commands.ExecuteCustomAction.RunAndWait(_repo.FullPath, CustomAction.Executable, _args, output => CallUIThread(() => ProgressDescription = output));
|
||||
else
|
||||
Commands.ExecuteCustomAction.Run(_repo.FullPath, CustomAction.Executable, _args);
|
||||
|
||||
log.Complete();
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return true;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue