private void BranchDropDown(object sender, EventArgs e) { GitModule module = new GitModule(Directory.Text); Branch.DisplayMember = "Name"; IList<GitRef> heads; if (module.IsValidGitWorkingDir()) heads = module.GetRefs(false); else heads = new List<GitRef>(); heads.Insert(0, GitRef.NoHead(module)); Branch.DataSource = heads; }
private static GitRevision GetCurrentRevision(GitModule aModule, RevisionGrid RevisionGrid, List<GitRef> currentTags, List<GitRef> currentLocalBranches, List<GitRef> currentRemoteBranches, List<GitRef> currentBranches, GitRevision currentRevision) { if (currentRevision == null) { IList<GitRef> refs; if (RevisionGrid == null) { string currentRevisionGuid = aModule.GetCurrentCheckout(); refs = aModule.GetRefs(true, true).Where(gitRef => gitRef.Guid == currentRevisionGuid).ToList(); } else { currentRevision = RevisionGrid.GetCurrentRevision(); refs = currentRevision.Refs; } foreach (GitRef gitRef in refs) { if (gitRef.IsTag) currentTags.Add(gitRef); else if (gitRef.IsHead || gitRef.IsRemote) { currentBranches.Add(gitRef); if (gitRef.IsRemote) currentRemoteBranches.Add(gitRef); else currentLocalBranches.Add(gitRef); } } } return currentRevision; }