/// <summary> /// Raises the Remove Button event. /// </summary> /// TODO: <<IMPORTANT>> Implement confirmation before removing modified files from the index public static void OnButton_Remove(UVCBrowser browser) { browser.OnProcessStart(); if (VersionControl.versionControlType == VersionControlType.Git && mStagedFileSelected) { // Git only - Clicking the remove button for a staged file will unstage it UVCProcessPopup.Init(VersionControl.Reset(CommandLine.EmptyHandler, "HEAD", mSelectedFileCache), true, true, browser.OnProcessStop, true); } else { bool dialog = false; var modFiles = new System.Text.StringBuilder(); foreach(var file in mSelectedFileCache) { if (file.fileState2 == FileState.Modified || file.fileState2 == FileState.Untracked) { dialog = true; if (string.IsNullOrEmpty(file.path2)) { modFiles.Append(file.path1).Append('\n'); } else { modFiles.Append(file.path2).Append('\n'); } } } if (dialog) { if (EditorUtility.DisplayDialog( "Confirm Remove Modified or Untracked Files?", "The following files contain changes or information which is not in source control, and will be irretrievably lost if you remove them:\n" + modFiles.ToString(0, modFiles.Length -1), "Ok", "Cancel")) { UVCProcessPopup.Init(VersionControl.Remove(CommandLine.EmptyHandler, true, mSelectedFileCache), true, true, browser.OnProcessStop, true); } else { browser.OnProcessStop(-9999, null, null); } } else { UVCProcessPopup.Init(VersionControl.Remove(CommandLine.EmptyHandler, false, mSelectedFileCache), true, true, browser.OnProcessStop, true); } } }
/// <summary> /// Raises the Reset Button event. /// </summary> /// TODO: Implement button public static void OnButton_Reset(UVCBrowser browser) { string confirmation = mAnyFileSelected ? "This will undo all changes to the selected files and reset them to the last commit." : "This will undo all changes and reset to the last commit."; if (EditorUtility.DisplayDialog( "Confirm Reset?", confirmation, "Ok", "Cancel")) { browser.OnProcessStart(); UVCProcessPopup.Init(VersionControl.ResetLast(CommandLine.EmptyHandler, mSelectedFileCache), true, true, browser.OnProcessStop, true); } }
/// <summary> /// Raises the Push Button event. /// </summary> public static void OnButton_Push(UVCBrowser browser) { browser.OnProcessStart(); UVCPushPopup.Init(browser); }
/// <summary> /// Raises the Init Button event. /// </summary> /// TODO: Implement button public static void OnButton_Init(UVCBrowser browser) { browser.OnProcessStart(); UVCProcessPopup.Init(VersionControl.Initialize(CommandLine.EmptyHandler), true, true, browser.OnProcessStop, true); }
/// <summary> /// Raises the Commit Button event. /// </summary> /// TODO: Implement button public static void OnButton_Commit(UVCBrowser browser) { browser.OnProcessStart(); UVCCommitPopup.Init(browser); }
/// <summary> /// Raises the Checkout Branch Button event. /// </summary> public static void OnButton_CheckoutBranch(UVCBrowser browser) { browser.OnProcessStart(); UVCProcessPopup.Init(VersionControl.Checkout(CommandLine.EmptyHandler, mLocalBranchNames[mLocalBranchIndex], true), false, true, OnCheckoutBranch, true); }
/// <summary> /// Raises the Add Button event. /// </summary> public static void OnButton_Add(UVCBrowser browser) { browser.OnProcessStart(); UVCProcessPopup.Init(VersionControl.Add(CommandLine.EmptyHandler, mSelectedFileCache), true, true, browser.OnProcessStop, true); }