Example #1
0
        private bool MatchHave(AnyObjectId id)
        {
            RevObject o;

            try
            {
                o = _walk.parseAny(id);
            }
            catch (IOException)
            {
                return(false);
            }

            if (!o.has(PEER_HAS))
            {
                o.add(PEER_HAS);
                RevCommit oComm = (o as RevCommit);
                if (oComm != null)
                {
                    oComm.carry(PEER_HAS);
                }
                AddCommonBase(o);
            }
            return(true);
        }
        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);
                    }
                }
            }
        }
Example #3
0
        private void MarkCommon(RevObject obj)
        {
            obj.add(COMMON);
            RevCommit oComm = (obj as RevCommit);

            if (oComm != null)
            {
                oComm.carry(COMMON);
            }
        }
 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);
 }
Example #5
0
        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);
                    }
                }
            }
        }