Beispiel #1
0
        private void MaybeUpdateData()
        {
            if (currentBranchAndRemoteChangeHasUpdate)
            {
                currentBranch = Repository.CurrentBranch ?? GitBranch.Default;
                currentRemote = Repository.CurrentRemote ?? GitRemote.Default;
            }

            if (localAndRemoteBranchListHasUpdate)
            {
                localBranches  = Repository.LocalBranches.ToList();
                remoteBranches = Repository.RemoteBranches.ToList();
            }

            if (currentBranchAndRemoteChangeHasUpdate || localAndRemoteBranchListHasUpdate)
            {
                currentBranchAndRemoteChangeHasUpdate = false;
                localAndRemoteBranchListHasUpdate     = false;

                BuildTree();
            }

            disableDelete = treeLocals.SelectedNode == null || treeLocals.SelectedNode.IsFolder || treeLocals.SelectedNode.IsActive;
            disableCreate = treeLocals.SelectedNode == null || treeLocals.SelectedNode.IsFolder || treeLocals.SelectedNode.Level == 0;
        }
Beispiel #2
0
        private int CompareBranches(GitBranch a, GitBranch b)
        {
            if (a.Name.Equals("master"))
            {
                return(-1);
            }

            if (b.Name.Equals("master"))
            {
                return(1);
            }

            return(a.Name.CompareTo(b.Name));
        }
Beispiel #3
0
        public void UpdateData(IRepositoryInfoCacheData data)
        {
            var now       = DateTimeOffset.Now;
            var isUpdated = false;

            if (forcedInvalidation || !Nullable.Equals(currentGitRemote, data.CurrentGitRemote))
            {
                currentGitRemote = data.CurrentGitRemote ?? GitRemote.Default;
                isUpdated        = true;
            }

            if (forcedInvalidation || !Nullable.Equals(currentGitBranch, data.CurrentGitBranch))
            {
                currentGitBranch = data.CurrentGitBranch ?? GitBranch.Default;
                isUpdated        = true;
            }

            if (forcedInvalidation || !Nullable.Equals(currentConfigRemote, data.CurrentConfigRemote))
            {
                currentConfigRemote = data.CurrentConfigRemote ?? ConfigRemote.Default;
                isUpdated           = true;
            }

            if (forcedInvalidation || !Nullable.Equals(currentConfigBranch, data.CurrentConfigBranch))
            {
                currentConfigBranch = data.CurrentConfigBranch ?? ConfigBranch.Default;
                isUpdated           = true;
            }

            if (forcedInvalidation || !String.Equals(currentHead, data.CurrentHead))
            {
                currentHead = data.CurrentHead;
                isUpdated   = true;
            }

            SaveData(now, isUpdated);
        }
Beispiel #4
0
 public bool Equals(GitBranch other)
 {
     return
         (String.Equals(name, other.name) &&
          String.Equals(tracking, other.tracking));
 }
Beispiel #5
0
 public GitBranchTreeData(GitBranch gitBranch, bool isActive)
 {
     GitBranch     = gitBranch;
     this.isActive = isActive;
 }