ResetHard() public method

public ResetHard ( string commit ) : string
commit string
return string
Exemplo n.º 1
0
 public static bool AbortCurrentAction(GitModule module)
 {
     if (ShowAbortMessage())
     {
         module.ResetHard("");
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public static bool AbortCurrentAction(GitModule module)
 {
     var strings = new Abort();
     if (MessageBox.Show(strings._abortCurrentOpperation.Text, strings._abortCurrentOpperationCaption.Text,
         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (MessageBox.Show(strings._areYouSureYouWantDeleteFiles.Text, strings._areYouSureYouWantDeleteFilesCaption.Text,
             MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             module.ResetHard("");
             return true;
         }
     }
     return false;
 }
Exemplo n.º 3
0
        private void resetSubmoduleChanges_Click(object sender, EventArgs e)
        {
            var unStagedFiles = (List<GitItemStatus>)Unstaged.SelectedItems;
            if (unStagedFiles.Count == 0)
                return;

            if (!Abort.ShowAbortMessage())
                return;

            foreach (var item in unStagedFiles.Where(it => it.IsSubmodule))
            {
                GitModule module = new GitModule(Settings.WorkingDir + item.Name + Settings.PathSeparator.ToString());
                module.ResetHard("");
            }

            Initialize();
        }
Exemplo n.º 4
0
        private void resetSubmoduleChanges_Click(object sender, EventArgs e)
        {
            var unStagedFiles = (List<GitItemStatus>)Unstaged.SelectedItems;
            if (unStagedFiles.Count == 0)
                return;

            // Show a form asking the user if they want to reset the changes.
            FormResetChanges.ResultType resetType = FormResetChanges.ShowResetDialog(this, true, true);
            if (resetType == FormResetChanges.ResultType.CANCEL)
                return;

            foreach (var item in unStagedFiles.Where(it => it.IsSubmodule))
            {
                GitModule module = new GitModule(Module.WorkingDir + item.Name + Settings.PathSeparator.ToString());

                // Reset all changes.
                module.ResetHard("");

                // Also delete new files, if requested.
                if (resetType == FormResetChanges.ResultType.RESET_AND_DELETE)
                {
                    var unstagedFiles = module.GetUnstagedFiles();
                    foreach (var file in unstagedFiles.Where(file => file.IsNew))
                    {
                        try
                        {
                            File.Delete(module.WorkingDir + file.Name);
                        }
                        catch (System.IO.IOException) { }
                        catch (System.UnauthorizedAccessException) { }
                    }
                }
            }

            Initialize();
        }