private void Needs(RevObject obj)
        {
            if (obj.has(COMPLETE))
            {
                return;
            }

            if (!obj.has(IN_WORK_QUEUE))
            {
                obj.add(IN_WORK_QUEUE);
                _workQueue.AddLast(obj);
            }
        }
Ejemplo n.º 2
0
 private void advertiseAnyOnce(RevObject obj, string refName)
 {
     if (!obj.has(ADVERTISED))
     {
         advertiseAny(obj, refName);
     }
 }
Ejemplo n.º 3
0
        private void Want(RevObject o)
        {
            if (o.has(WANT))
            {
                return;
            }

            o.add(WANT);
            _wantAll.Add(o);

            if (o is RevCommit)
            {
                _wantCommits.Add((RevCommit)o);
            }

            else if (o is RevTag)
            {
                do
                {
                    o = ((RevTag)o).getObject();
                } while (o is RevTag);
                if (o is RevCommit)
                {
                    Want(o);
                }
            }
        }
Ejemplo n.º 4
0
        private void QueueWants(IEnumerable <Ref> want)
        {
            var inWorkQueue = new List <ObjectId>();

            foreach (Ref r in want)
            {
                ObjectId id = r.ObjectId;
                try
                {
                    RevObject obj = _revWalk.parseAny(id);
                    if (obj.has(COMPLETE))
                    {
                        continue;
                    }
                    inWorkQueue.Add(id);
                    obj.add(IN_WORK_QUEUE);
                    _workQueue.AddLast(obj);
                }
                catch (MissingObjectException)
                {
                    inWorkQueue.Add(id);
                    _workQueue.AddLast(id);
                }
                catch (IOException e)
                {
                    throw new TransportException("Cannot Read " + id.Name, e);
                }
            }
        }
Ejemplo n.º 5
0
        private void Want(RevObject o)
        {
            if (o.has(WANT))
            {
                return;
            }

            o.add(WANT);
            _wantAll.Add(o);

            RevTag oTag = (o as RevTag);

            while (oTag != null)
            {
                o    = oTag.getObject();
                oTag = (o as RevTag);
            }

            RevCommit oComm = (o as RevCommit);

            if (oComm != null)
            {
                _wantCommits.Add(oComm);
            }
        }
Ejemplo n.º 6
0
 private void AddCommonBase(RevObject o)
 {
     if (o.has(COMMON))
     {
         return;
     }
     o.add(COMMON);
     _commonBase.Add(o);
 }
Ejemplo n.º 7
0
        protected override void doFetch(ProgressMonitor monitor, List <Ref> want, List <ObjectId> have)
        {
            MarkLocalRefsComplete(have);
            QueueWants(want);

            while (!monitor.IsCancelled && _workQueue.Count > 0)
            {
                ObjectId id = _workQueue.First.Value;
                _workQueue.RemoveFirst();
                RevObject ro = (id as RevObject);
                if (ro == null || !ro.has(COMPLETE))
                {
                    DownloadObject(monitor, id);
                }
                Process(id);
            }
        }
        private void MarkTreeComplete(RevTree tree)
        {
            if (tree.has(COMPLETE))
            {
                return;
            }

            tree.add(COMPLETE);
            _treeWalk.reset(tree);
            while (_treeWalk.next())
            {
                FileMode mode  = _treeWalk.getFileMode(0);
                int      sType = (int)mode.ObjectType;

                switch (sType)
                {
                case Constants.OBJ_BLOB:
                    _treeWalk.getObjectId(_idBuffer, 0);
                    _revWalk.lookupAny(_idBuffer, sType).add(COMPLETE);
                    continue;

                case Constants.OBJ_TREE:
                {
                    _treeWalk.getObjectId(_idBuffer, 0);
                    RevObject o = _revWalk.lookupAny(_idBuffer, sType);
                    if (!o.has(COMPLETE))
                    {
                        o.add(COMPLETE);
                        _treeWalk.enterSubtree();
                    }
                    continue;
                }

                default:
                    if (FileMode.GitLink.Equals(sType))
                    {
                        continue;
                    }
                    _treeWalk.getObjectId(_idBuffer, 0);
                    throw new CorruptObjectException("Invalid mode " + mode.ObjectType + " for " + _idBuffer.Name + " " +
                                                     _treeWalk.getPathString() + " in " + tree.Name);
                }
            }
        }
Ejemplo n.º 9
0
        public void addObject(RevObject robject)
        {
            if (robject.has(RevFlag.UNINTERESTING))
            {
                _edgeObjects.Add(robject);
                Thin = true;
                return;
            }

            var otp = new ObjectToPack(robject, robject.Type);

            try
            {
                _objectsLists[robject.Type].Add(otp);
            }
            catch (IndexOutOfRangeException)
            {
                throw new IncorrectObjectTypeException(robject, "COMMIT nor TREE nor BLOB nor TAG");
            }
            _objectsMap.Add(otp);
        }