예제 #1
0
    /// <summary>
    /// Checks out the given commit on the given branch
    /// </summary>
    public void Checkout(IBranch branch, ICommit commit)
    {
        // Need to allow them to checkout the last created branch because that's how "create branch" works
        if (!EnabledVersionControls.Instance().CanCheckout&& !lastCreatedBranch.Equals(branch))
        {
            Debug.Log("Can't Checkout branch; not enabled yet");
            return;
        }
        LoadStateOfCommit(commit);
        activeCommit = commit;
        activeBranch = branch;
        if (!activeCommit.Equals(activeBranch.GetTip()))
        {
            this.isDetached = true;
        }
        else
        {
            this.isDetached = false;
        }

        if (checkoutTrigger != null)
        {
            checkoutTrigger.Trigger();
        }

        UIController.Instance().UpdateOverlay();
    }