Ejemplo n.º 1
0
 /// <summary>
 /// Initialize the fetch popup.
 /// </summary>
 /// <param name='browser'>
 /// The main browser instance.
 /// </param>
 public static void Init(UVCBrowser browser)
 {
     var window = EditorWindow.CreateInstance<UVCFetchPopup>();
     window.title = "Fetch";
     window.browser = browser;
     window.ShowUtility();
 }
 /// <summary>
 /// Initialize the commit popup.
 /// </summary>
 /// <param name='browser'>
 /// The main browser instance.
 /// </param>
 public static void Init(UVCBrowser browser)
 {
     var window = EditorWindow.CreateInstance<UVCCommitPopup>();
     window.title = "Commit Changes";
     window.browser = browser;
     window.ShowUtility();
 }
    /// <summary>
    /// Initialize the settings popup.
    /// </summary>
    /// <param name='browser'>
    /// The main browser instance.
    /// </param>
    public static void Init(UVCBrowser browser)
    {
        var window = EditorWindow.CreateInstance <UVCSettingsPopup>();

        window.title   = "Settings";
        window.browser = browser;
        window.ShowUtility();
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Initialize the commit popup.
    /// </summary>
    /// <param name='browser'>
    /// The main browser instance.
    /// </param>
    public static void Init(UVCBrowser browser)
    {
        var window = EditorWindow.CreateInstance <UVCCommitPopup>();

        window.title   = "Commit Changes";
        window.browser = browser;
        window.ShowUtility();
    }
        /// <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.DisableGUI();
                UVCProcessPopup.Init(VersionControl.ResetLast(CommandLine.EmptyHandler, mSelectedFileCache), true, true, browser.OnProcessStop, true);
            }
        }
        /// <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.DisableGUI();
            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 Add Button event.
 /// </summary>
 public static void OnButton_Add(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Add(CommandLine.EmptyHandler, mSelectedFileCache), true, true, browser.OnProcessStop, true);
 }
 /// <summary>
 /// Raises the Settings Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Settings(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Settings Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Settings(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCSettingsPopup.Init(browser);
 }
        /// <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.DisableGUI();
            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 Merge Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Merge(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Commit Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Commit(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCCommitPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Add Button event.
 /// </summary>
 public static void OnButton_Add(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Add(CommandLine.EmptyHandler, mSelectedFileCache), true, true, browser.OnProcessStop, true);
 }
 /// <summary>
 /// Raises the Checkout Branch Button event.
 /// </summary>
 public static void OnButton_CheckoutBranch(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Checkout(CommandLine.EmptyHandler, mLocalBranchNames[mLocalBranchIndex], true), false, true, OnCheckoutBranch, true);
 }
 /// <summary>
 /// Raises the Checkout Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Checkout(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Commit Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Commit(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCCommitPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Init Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Init(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Initialize(CommandLine.EmptyHandler), true, true, browser.OnProcessStop, true);
 }
 /// <summary>
 /// Raises the Checkout Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Checkout(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Checkout Branch Button event.
 /// </summary>
 public static void OnButton_CheckoutBranch(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Checkout(CommandLine.EmptyHandler, mLocalBranchNames[mLocalBranchIndex], true), false, true, OnCheckoutBranch, true);
 }
 /// <summary>
 /// Raises the Pull Button event.
 /// </summary>
 public static void OnButton_Pull(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCPullPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Init Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Init(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCProcessPopup.Init(VersionControl.Initialize(CommandLine.EmptyHandler), true, true, browser.OnProcessStop, true);
 }
 /// <summary>
 /// Raises the Branch Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Branch(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCBranchPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Push Button event.
 /// </summary>
 public static void OnButton_Push(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCPushPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Merge Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Merge(UVCBrowser browser)
 {
 }
 /// <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.DisableGUI();
         UVCProcessPopup.Init(VersionControl.ResetLast(CommandLine.EmptyHandler, mSelectedFileCache), 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 Tag Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Tag(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Settings Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Settings(UVCBrowser browser)
 {
     browser.DisableGUI();
     UVCSettingsPopup.Init(browser);
 }
 /// <summary>
 /// Raises the Tag Button event.
 /// </summary>
 /// TODO: Implement button
 public static void OnButton_Tag(UVCBrowser browser)
 {
 }
 /// <summary>
 /// Raises the Push Button event.
 /// </summary>
 public static void OnButton_Push(UVCBrowser browser)
 {
     browser.OnProcessStart();
     UVCPushPopup.Init(browser);
 }