private void MarkReachable(IEnumerable <ObjectId> have, int maxTime) { foreach (Ref r in local.getAllRefs().Values) { try { RevCommit o = _walk.parseCommit(r.ObjectId); o.add(REACHABLE); _reachableCommits.add(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.add(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 = (maxTime * 1000L).MillisToUtcDateTime(); _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)) { c.add(COMMON); c.carry(COMMON); _reachableCommits.add(c); } } } }
private void MarkReachable(IEnumerable <ObjectId> have, int maxTime) { foreach (Ref r in local.getAllRefs().Values) { try { RevCommit o = _walk.parseCommit(r.ObjectId); o.add(REACHABLE); _reachableCommits.add(o); } catch (IOException) { } } foreach (ObjectId id in have) { try { RevCommit o = _walk.parseCommit(id); o.add(REACHABLE); _reachableCommits.add(o); } catch (IOException) { } } if (maxTime > 0) { DateTime maxWhen = new DateTime(1970, 1, 1) + TimeSpan.FromSeconds(maxTime); _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)) { c.add(COMMON); c.carry(COMMON); _reachableCommits.add(c); } } } }