Beispiel #1
0
        //TODO FIX
        internal void UndoFileChanges(string fileName)
        {
            GitFileStatus status = GetFileStatus(fileName);

            if (status == GitFileStatus.Modified || status == GitFileStatus.Staged ||
                status == GitFileStatus.Deleted || status == GitFileStatus.Removed)
            {
                var deleteMsg = "";
                if (status == GitFileStatus.Deleted || status == GitFileStatus.Removed)
                {
                    deleteMsg = @"

Note: you will need to click 'Show All Files' in solution explorer to see the file.";
                }

                if (MessageBox.Show("Are you sure you want to undo changes for " + Path.GetFileName(fileName) +
                                    " and restore a version from the last commit? " + deleteMsg,
                                    "Undo Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CurrentTracker.UndoFileChanges(fileName);

                    //SaveFileFromRepository(fileName, fileName);
                    if (status == GitFileStatus.Staged || status == GitFileStatus.Removed)
                    {
                        CurrentTracker.UnStageFile(fileName);
                    }
                    //CurrentTracker.CheckOutFile(fileName);
                }
            }
        }
 private void menuUnstage_Click(object sender, RoutedEventArgs e)
 {
     GetSelectedFileFullName(fileName =>
     {
         CurrentTracker.UnStageFile(fileName);
         ShowStatusMessage("Un-staged file: " + fileName);
     }, false);
 }