/// <exception cref="System.IO.IOException"></exception> private void MarkReachable(ICollection <ObjectId> have, int maxTime) { foreach (Ref r in local.GetAllRefs().Values) { try { RevCommit o = walk.ParseCommit(r.GetObjectId()); o.Add(REACHABLE); reachableCommits.AddItem(o); } catch (IOException) { } } // If we cannot read the value of the ref skip it. foreach (ObjectId id in have) { try { RevCommit o = walk.ParseCommit(id); o.Add(REACHABLE); reachableCommits.AddItem(o); } catch (IOException) { } } // If we cannot read the value of the ref skip it. if (maxTime > 0) { // Mark reachable commits until we reach maxTime. These may // wind up later matching up against things we want and we // can avoid asking for something we already happen to have. // DateTime maxWhen = Sharpen.Extensions.CreateDate(maxTime * 1000L); walk.Sort(RevSort.COMMIT_TIME_DESC); walk.MarkStart(reachableCommits); walk.SetRevFilter(CommitTimeRevFilter.After(maxWhen)); for (; ;) { RevCommit c = walk.Next(); if (c == null) { break; } if (c.Has(ADVERTISED) && !c.Has(COMMON)) { // This is actually going to be a common commit, but // our peer doesn't know that fact yet. // c.Add(COMMON); c.Carry(COMMON); reachableCommits.AddItem(c); } } } }
/// <exception cref="NGit.Errors.MissingObjectException"></exception> /// <exception cref="System.IO.IOException"></exception> private void PushLocalCommit(RevCommit p) { if (p.Has(LOCALLY_SEEN)) { return; } revWalk.ParseHeaders(p); p.Add(LOCALLY_SEEN); p.Add(COMPLETE); p.Carry(COMPLETE); localCommitQueue.Add(p); }
/// <exception cref="System.IO.IOException"></exception> private void MarkReachable(ICollection <ObjectId> have, int maxTime) { foreach (Ref r in local.GetAllRefs().Values) { ObjectId id = r.GetPeeledObjectId(); if (id == null) { id = r.GetObjectId(); } if (id == null) { continue; } ParseReachable(id); } foreach (ObjectId id_1 in local.GetAdditionalHaves()) { ParseReachable(id_1); } foreach (ObjectId id_2 in have) { ParseReachable(id_2); } if (maxTime > 0) { // Mark reachable commits until we reach maxTime. These may // wind up later matching up against things we want and we // can avoid asking for something we already happen to have. // DateTime maxWhen = Sharpen.Extensions.CreateDate(maxTime * 1000L); walk.Sort(RevSort.COMMIT_TIME_DESC); walk.MarkStart(reachableCommits); walk.SetRevFilter(CommitTimeRevFilter.After(maxWhen)); for (; ;) { RevCommit c = walk.Next(); if (c == null) { break; } if (c.Has(ADVERTISED) && !c.Has(COMMON)) { // This is actually going to be a common commit, but // our peer doesn't know that fact yet. // c.Add(COMMON); c.Carry(COMMON); reachableCommits.AddItem(c); } } } }