示例#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));
 }