private void BranchDropDown(object sender, EventArgs e)
 {
     GitModule module = new GitModule(Directory.Text);
     Branch.DisplayMember = "Name";
     IList<GitHead> heads;
     if (module.ValidWorkingDir())
         heads = module.GetHeads(false);
     else
         heads = new List<GitHead>();
     heads.Insert(0, GitHead.NoHead(module));
     Branch.DataSource = heads;
 }
Example #2
0
        private static GitRevision GetCurrentRevision(GitModule aModule, RevisionGrid RevisionGrid, List<GitHead> currentTags, List<GitHead> currentLocalBranches,
                                                      List<GitHead> currentRemoteBranches, List<GitHead> currentBranches,
                                                      GitRevision currentRevision, string option)
        {
            if (option.StartsWith("{c") && currentRevision == null)
            {
                IList<GitHead> heads;

                if (RevisionGrid == null)
                {
                    heads = new List<GitHead>();
                    string currentRevisionGuid = aModule.GetCurrentCheckout();
                    foreach (GitHead head in aModule.GetHeads(true, true))
                    {
                        if (head.Guid == currentRevisionGuid)
                            heads.Add(head);
                    }
                }
                else
                {
                    currentRevision = RevisionGrid.GetCurrentRevision();
                    heads = currentRevision.Heads;
                }

                foreach (GitHead head in heads)
                {
                    if (head.IsTag)
                        currentTags.Add(head);
                    else if (head.IsHead || head.IsRemote)
                    {
                        currentBranches.Add(head);
                        if (head.IsRemote)
                            currentRemoteBranches.Add(head);
                        else
                            currentLocalBranches.Add(head);
                    }
                }
            }
            return currentRevision;
        }