本文整理汇总了C#中GitUI.FormProcess.ErrorOccured方法的典型用法代码示例。如果您正苦于以下问题:C# FormProcess.ErrorOccured方法的具体用法?C# FormProcess.ErrorOccured怎么用?C# FormProcess.ErrorOccured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitUI.FormProcess
的用法示例。
在下文中一共展示了FormProcess.ErrorOccured方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Ok_Click
private void Ok_Click(object sender, EventArgs e)
{
FormProcess process = new FormProcess(GitCommands.GitCommands.MergeBranchCmd(Branches.Text, !NoFastForward.Checked));
MergeConflictHandler.HandleMergeConflicts();
if (!process.ErrorOccured())
Close();
}
示例2: OkClick
private void OkClick(object sender, EventArgs e)
{
var process = new FormProcess(GitCommands.GitCommands.MergeBranchCmd(Branches.Text, fastForward.Checked, _NO_TRANSLATE_mergeStrategy.Text));
process.ShowDialog();
MergeConflictHandler.HandleMergeConflicts();
if (!process.ErrorOccured())
Close();
}
示例3: Ok_Click
private void Ok_Click(object sender, EventArgs e)
{
try
{
string dirTo = To.Text;
if (!dirTo.EndsWith("\\") && !dirTo.EndsWith("/"))
dirTo += "\\";
dirTo += NewDirectory.Text;
RepositoryHistory.AddMostRecentRepository(From.Text);
RepositoryHistory.AddMostRecentRepository(dirTo);
//CloneDto dto = new CloneDto(From.Text, To.Text, CentralRepository.Checked);
//GitCommands.Clone commit = new GitCommands.Clone(dto);
//commit.Execute();
FormProcess fromProcess;
fromProcess = new FormProcess(Settings.GitDir + "git.cmd", GitCommands.GitCommands.CloneCmd(From.Text, dirTo, CentralRepository.Checked));
if (!fromProcess.ErrorOccured() && !GitCommands.GitCommands.InTheMiddleOfPatch())
{
if (this.ShowInTaskbar == false)
{
if (MessageBox.Show("The repository has been cloned successfully." + Environment.NewLine + "Do you want to open the new repository \"" + dirTo + "\" now?", "Open", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
GitCommands.Settings.WorkingDir = dirTo;
if (File.Exists(GitCommands.Settings.WorkingDir + ".gitmodules"))
{
if (MessageBox.Show("The cloned has submodules configured." + Environment.NewLine + "Do you want to initialize the submodules?" + Environment.NewLine + Environment.NewLine + "This will initialize and update all submodules recursive.", "Submodules", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
FormProcess process = new FormProcess(GitCommands.GitCommands.SubmoduleInitCmd(""));
InitializeSubmodulesRecursive();
}
}
}
}
Close();
}
}
catch
{
}
}
示例4: DoCommit
private void DoCommit(bool amend)
{
if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
{
MessageBox.Show("There are unresolved mergeconflicts, solve mergeconflicts before committing", "Merge conflicts");
return;
}
if (Message.Text.Length == 0)
{
MessageBox.Show("Please enter commit message");
return;
}
if (GitCommands.GitCommands.GetSelectedBranch().CompareTo("(no branch)") == 0)
{
if (MessageBox.Show("You are not working on a branch." + Environment.NewLine + "This commit will be unreferenced when switching to another brach and can be lost." + Environment.NewLine + "" + Environment.NewLine + "Do you want to continue?", "Not on a branch.", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
}
try
{
using (StreamWriter textWriter = new StreamWriter(GitCommands.Settings.WorkingDirGitDir() + "\\COMMITMESSAGE", false))
{
textWriter.Write(Message.Text);
textWriter.Flush();
textWriter.Close();
}
FormProcess form = new FormProcess(GitCommands.GitCommands.CommitCmd(amend));
NeedRefresh = true;
if (!form.ErrorOccured())
{
Close();
File.Delete(GitCommands.Settings.WorkingDirGitDir() + "\\COMMITMESSAGE");
}
}
catch(Exception e)
{
MessageBox.Show("Exception: " + e.Message);
}
}
示例5: PushClick
private void PushClick(object sender, EventArgs e)
{
if (PullFromUrl.Checked && string.IsNullOrEmpty(PushDestination.Text))
{
MessageBox.Show(_selectDestinationDirectory.Text);
return;
}
if (PullFromRemote.Checked && string.IsNullOrEmpty(Remotes.Text))
{
MessageBox.Show(_selectRemote.Text);
return;
}
if (TabControlTagBranch.SelectedTab == TagTab && string.IsNullOrEmpty(TagComboBox.Text) &&
!PushAllTags.Checked)
{
MessageBox.Show(_selectTag.Text);
return;
}
//Extra check if the branch is already known to the remote, give a warning when not.
//This is not possible when the remote is an URL, but this is ok since most users push to
//known remotes anyway.
if (TabControlTagBranch.SelectedTab == BranchTab && PullFromRemote.Checked)
{
//The current branch is not known by the remote (as far as we now since we are disconnected....)
if (!GitCommands.GitCommands.GetBranches(true, Remotes.Text).Contains(RemoteBranch.Text))
//Ask if this is what the user wants
if (MessageBox.Show(_branchNewForRemote.Text, _pushCaption.Text, MessageBoxButtons.YesNo) ==
DialogResult.No)
return;
}
Repositories.RepositoryHistory.AddMostRecentRepository(PushDestination.Text);
var remote = "";
string destination;
if (PullFromUrl.Checked)
{
destination = PushDestination.Text;
}
else
{
if (GitCommands.GitCommands.Plink())
{
if (!File.Exists(Settings.Pageant))
MessageBox.Show(_cannotLoadPutty.Text, PuttyText);
else
GitCommands.GitCommands.StartPageantForRemote(Remotes.Text);
}
destination = Remotes.Text;
remote = Remotes.Text.Trim();
}
string pushCmd;
if (TabControlTagBranch.SelectedTab == BranchTab)
pushCmd = GitCommands.GitCommands.PushCmd(destination, Branch.Text, RemoteBranch.Text,
PushAllBranches.Checked, ForcePushBranches.Checked);
else
pushCmd = GitCommands.GitCommands.PushTagCmd(destination, TagComboBox.Text, PushAllTags.Checked,
ForcePushBranches.Checked);
var form = new FormProcess(pushCmd)
{
Remote = remote,
Text = string.Format(_pushToCaption.Text, destination)
};
form.ShowDialog();
if (!GitCommands.GitCommands.InTheMiddleOfConflictedMerge() &&
!GitCommands.GitCommands.InTheMiddleOfRebase() && !form.ErrorOccured())
Close();
}
示例6: DoCommit
private void DoCommit(bool amend)
{
if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
{
MessageBox.Show(mergeConflicts.Text, mergeConflictsCaption.Text);
return;
}
if (Message.Text.Length < 2)
{
MessageBox.Show(enterCommitMessage.Text, enterCommitMessageCaption.Text);
return;
}
if (GitCommands.GitCommands.GetSelectedBranch().CompareTo("(no branch)") == 0)
{
if (MessageBox.Show(notOnBranch.Text, notOnBranchCaption.Text, MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
}
try
{
using (StreamWriter textWriter = new StreamWriter(GitCommands.Settings.WorkingDirGitDir() + "\\COMMITMESSAGE", false, Settings.Encoding))
{
int lineNumber = 0;
foreach (string line in Message.Text.Split('\n'))
{
if (lineNumber == 1 && !string.IsNullOrEmpty(line))
textWriter.WriteLine();
textWriter.WriteLine(line);
lineNumber++;
}
}
FormProcess form = new FormProcess(GitCommands.GitCommands.CommitCmd(amend));
form.ShowDialog();
NeedRefresh = true;
if (!form.ErrorOccured())
{
Message.Text = string.Empty;
if (CloseDialogAfterCommit.Checked)
{
Close();
}
else
{
foreach (GitItemStatus gitItemStatus in Unstaged.GitItemStatusses)
{
if (gitItemStatus.IsTracked)
{
InitializedStaged();
return;
}
}
Close();
}
}
}
catch (Exception e)
{
MessageBox.Show("Exception: " + e.Message);
}
}
示例7: DoCommit
private void DoCommit(bool amend)
{
if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
{
MessageBox.Show(_mergeConflicts.Text, _mergeConflictsCaption.Text);
return;
}
if (Message.Text.Length < 2)
{
MessageBox.Show(_enterCommitMessage.Text, _enterCommitMessageCaption.Text);
return;
}
if (GitCommands.GitCommands.GetSelectedBranch().CompareTo("(no branch)") == 0 &&
MessageBox.Show(_notOnBranch.Text, _notOnBranchCaption.Text, MessageBoxButtons.YesNo) == DialogResult.No)
return;
try
{
SetCommitMessageFromTextBox(Message.Text);
var form = new FormProcess(GitCommands.GitCommands.CommitCmd(amend));
form.ShowDialog();
NeedRefresh = true;
if (form.ErrorOccured())
return;
Message.Text = string.Empty;
if (CloseDialogAfterCommit.Checked)
{
Close();
return;
}
foreach (var gitItemStatus in Unstaged.GitItemStatusses)
{
if (gitItemStatus.IsTracked)
{
InitializedStaged();
return;
}
}
Close();
}
catch (Exception e)
{
MessageBox.Show(string.Format("Exception: {0}", e.Message));
}
}
示例8: OkClick
private void OkClick(object sender, EventArgs e)
{
try
{
var dirTo = _NO_TRANSLATE_To.Text;
if (!dirTo.EndsWith(Settings.PathSeperator.ToString()) && !dirTo.EndsWith(Settings.PathSeperatorWrong.ToString()))
dirTo += Settings.PathSeperator.ToString();
dirTo += _NO_TRANSLATE_NewDirectory.Text;
Repositories.RepositoryHistory.AddMostRecentRepository(_NO_TRANSLATE_From.Text);
Repositories.RepositoryHistory.AddMostRecentRepository(dirTo);
var fromProcess =
new FormProcess(Settings.GitCommand,
GitCommands.GitCommands.CloneCmd(_NO_TRANSLATE_From.Text, dirTo,
CentralRepository.Checked, null));
fromProcess.ShowDialog();
if (fromProcess.ErrorOccured() || GitCommands.GitCommands.InTheMiddleOfPatch())
return;
if (ShowInTaskbar == false && AskIfNewRepositoryShouldBeOpened(dirTo))
{
Settings.WorkingDir = dirTo;
if (File.Exists(Settings.WorkingDir + ".gitmodules") &&
AskIfSubmodulesShouldBeInitialized())
InitSubmodules();
}
Close();
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
示例9: DoCommit
private void DoCommit(bool amend)
{
if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
{
MessageBox.Show("There are unresolved mergeconflicts, solve mergeconflicts before committing", "Merge conflicts");
return;
}
if (Message.Text.Length == 0)
{
MessageBox.Show("Please enter commit message");
return;
}
if (GitCommands.GitCommands.GetSelectedBranch().CompareTo("(no branch)") == 0)
{
if (MessageBox.Show("You are not working on a branch." + Environment.NewLine + "This commit will be unreferenced when switching to another brach and can be lost." + Environment.NewLine + "" + Environment.NewLine + "Do you want to continue?", "Not on a branch.", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
}
try
{
using (StreamWriter textWriter = new StreamWriter(GitCommands.Settings.WorkingDirGitDir() + "\\COMMITMESSAGE", false, Settings.Encoding))
{
int lineNumber = 0;
foreach (string line in Message.Text.Split('\n'))
{
if (lineNumber == 1 && !string.IsNullOrEmpty(line))
textWriter.WriteLine();
textWriter.WriteLine(line);
lineNumber++;
}
}
FormProcess form = new FormProcess(GitCommands.GitCommands.CommitCmd(amend));
NeedRefresh = true;
if (!form.ErrorOccured())
{
Message.Text = string.Empty;
if (CloseDialogAfterCommit.Checked)
{
Close();
}
else
{
foreach (DataGridViewRow row in Unstaged.Rows)
{
if (((GitItemStatus)row.DataBoundItem).IsTracked)
{
InitializedStaged();
return;
}
}
Close();
}
}
}
catch(Exception e)
{
MessageBox.Show("Exception: " + e.Message);
}
}
示例10: Ok_Click
private void Ok_Click(object sender, EventArgs e)
{
try
{
FormProcess form;
//Get a localbranch name
int index = Branches.Text.LastIndexOfAny(new char[] { '\\', '/' });
string localBranchName = Branches.Text;
if (index > 0 && index + 1 < Branches.Text.Length)
localBranchName = localBranchName.Substring(index + 1);
string command = "checkout";
if (Remotebranch.Checked)
{
DialogResult result = MessageBox.Show( "You choose to checkout a remote branch." + Environment.NewLine + Environment.NewLine + "Do you want create a local branch with the name '" + localBranchName + "'" + Environment.NewLine + "that track's this remote branch?", "Checkout branch", MessageBoxButtons.YesNo );
if (result == DialogResult.Yes)
command += string.Format( " -b " + localBranchName );
}
else
{
}
if (Force.Checked)
command += " --force";
command += " \"" + Branches.Text + "\"";
form = new FormProcess( command );
form.ShowDialog();
if (!form.ErrorOccured())
Close();
}
catch
{
}
}
示例11: OkClick
private void OkClick(object sender, EventArgs e)
{
try
{
var command = "checkout";
if (Remotebranch.Checked)
{
//Get a localbranch name
var remoteName = GitCommands.GitCommands.GetRemoteName(Branches.Text, GitCommands.GitCommands.GetRemotes());
var localBranchName = Branches.Text.Substring(remoteName.Length + 1);
//try to determine the 'best' name for a local branch, check if the local
//name for the remote branch is already used
if (LocalBranchExists(localBranchName))
localBranchName = string.Concat(remoteName, "_", localBranchName);
var result = MessageBox.Show(string.Format(trackRemoteBranch.Text, localBranchName), trackRemoteBranchCaption.Text, MessageBoxButtons.YesNoCancel);
if (result == DialogResult.Cancel)
return;
if (result == DialogResult.Yes)
command += string.Format(" -b {0}", localBranchName);
}
if (Force.Checked)
command += " --force";
command += " \"" + Branches.Text + "\"";
var form = new FormProcess(command);
form.ShowDialog();
if (!form.ErrorOccured())
Close();
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
示例12: OkClick
private void OkClick(object sender, EventArgs e)
{
try
{
//Get a localbranch name
var remoteName = GitCommands.GitCommands.GetRemoteName(Branches.Text, GitCommands.GitCommands.GetRemotes());
var localBranchName = Branches.Text.Substring(remoteName.Length + 1);
var command = "checkout";
if (Remotebranch.Checked)
{
var result =
MessageBox.Show(
"You choose to checkout a remote branch." + Environment.NewLine + Environment.NewLine +
"Do you want create a local branch with the name '" + localBranchName + "'" +
Environment.NewLine + "that track's this remote branch?", "Checkout branch",
MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
command += string.Format(" -b {0}", localBranchName);
}
if (Force.Checked)
command += " --force";
command += " \"" + Branches.Text + "\"";
var form = new FormProcess(command);
form.ShowDialog();
if (!form.ErrorOccured())
Close();
}
catch(Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
示例13: DoCommit
private void DoCommit(bool amend)
{
if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
{
MessageBox.Show("There are unresolved mergeconflicts, solve mergeconflicts before committing", "Merge conflicts");
return;
}
if (Message.Text.Length == 0)
{
MessageBox.Show("Please enter commit message");
return;
}
try
{
StreamWriter textWriter = new StreamWriter(GitCommands.Settings.WorkingDirGitDir() + "\\COMMITMESSAGE", false);
textWriter.Write(Message.Text);
textWriter.Close();
FormProcess form = new FormProcess(GitCommands.GitCommands.CommitCmd(amend));
NeedRefresh = true;
if (!form.ErrorOccured())
Close();
}
catch(Exception e)
{
MessageBox.Show("Exception: " + e.Message);
}
}