Пример #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;
        }
Пример #2
0
        public void UpdateData(IRepositoryInfoCacheData data)
        {
            var now       = DateTimeOffset.Now;
            var isUpdated = false;

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

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

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

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

            SaveData(now, isUpdated);
        }
Пример #3
0
 public bool Equals(GitBranch other)
 {
     return
         (String.Equals(name, other.name) &&
          String.Equals(tracking, other.tracking) &&
          isActive == other.isActive);
 }
Пример #4
0
        private int CompareBranches(GitBranch a, GitBranch b)
        {
            if (a.Name.Equals("master"))
            {
                return(-1);
            }

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

            return(0);
        }
Пример #5
0
        private int CompareBranches(GitBranch a, GitBranch b)
        {
            if (GetFavourite(a.Name))
            {
                return -1;
            }

            if (GetFavourite(b.Name))
            {
                return 1;
            }

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

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

            return 0;
        }
Пример #6
0
 public GitBranchTreeData(GitBranch gitBranch)
 {
     GitBranch = gitBranch;
 }
Пример #7
0
 public GitBranchTreeData(GitBranch gitBranch, bool isActive)
 {
     GitBranch     = gitBranch;
     this.isActive = isActive;
 }
Пример #8
0
 public bool Equals(GitBranch other)
 {
     return
         (String.Equals(name, other.name) &&
          String.Equals(tracking, other.tracking));
 }