private bool HandlePushOnExit(ref bool isError, FormProcess form)
{
if (isError)
{
//auto pull only if current branch was rejected
Regex IsRejected = new Regex(Regex.Escape("! [rejected] ") + ".*" + Regex.Escape(_currentBranch) + ".*" + Regex.Escape(" (non-fast-forward)"), RegexOptions.Compiled);
if (Settings.AutoPullOnRejected && IsRejected.IsMatch(form.OutputString.ToString()))
{
if (Settings.PullMerge == Settings.PullAction.Fetch)
{
form.AppendOutputLine(Environment.NewLine + "Can not perform auto pull, when merge option is set to fetch.");
}
else if (IsRebasingMergeCommit())
{
form.AppendOutputLine(Environment.NewLine + "Can not perform auto pull, when merge option is set to rebase " + Environment.NewLine
+ "and one of the commits that are about to be rebased is a merge.");
}
else
{
bool pullCompleted;
UICommands.StartPullDialog(this, true, out pullCompleted);
if (pullCompleted)
{
form.Retry();
return(true);
}
}
}
}
return(false);
}