Exemplo n.º 1
0
        /**
         * Advance this walker to the next relevant entry.
         *
         * @return true if there is an entry available; false if all entries have
         *         been walked and the walk of this set of tree iterators is over.
         * @throws MissingObjectException
         *             {@link #isRecursive()} was enabled, a subtree was found, but
         *             the subtree object does not exist in this repository. The
         *             repository may be missing objects.
         * @throws IncorrectObjectTypeException
         *             {@link #isRecursive()} was enabled, a subtree was found, and
         *             the subtree id does not denote a tree, but instead names some
         *             other non-tree type of object. The repository may have data
         *             corruption.
         * @throws CorruptObjectException
         *             the contents of a tree did not appear to be a tree. The
         *             repository may have data corruption.
         * @throws IOException
         *             a loose object or pack file could not be Read.
         */
        public bool next()
        {
            try
            {
                if (_advance)
                {
                    _advance      = false;
                    _postChildren = false;
                    popEntriesEqual();
                }

                while (true)
                {
                    AbstractTreeIterator t = min();
                    if (t.eof())
                    {
                        if (_depth > 0)
                        {
                            ExitSubtree();
                            if (PostOrderTraversal)
                            {
                                _advance      = true;
                                _postChildren = true;
                                return(true);
                            }
                            popEntriesEqual();
                            continue;
                        }
                        return(false);
                    }

                    _currentHead = t;
                    if (!_filter.include(this))
                    {
                        skipEntriesEqual();
                        continue;
                    }

                    if (Recursive && FileMode.Tree == t.EntryFileMode)
                    {
                        enterSubtree();
                        continue;
                    }

                    _advance = true;
                    return(true);
                }
            }
            catch (StopWalkException)
            {
                foreach (AbstractTreeIterator t in _trees)
                {
                    t.stopWalk();
                }
                return(false);
            }
        }
Exemplo n.º 2
0
        public void testWrap()
        {
            GitSharp.Core.TreeWalk.TreeWalk tw = new GitSharp.Core.TreeWalk.TreeWalk(db);
            TreeFilter a = TreeFilter.ALL;
            TreeFilter n = NotTreeFilter.create(a);

            Assert.IsNotNull(n);
            Assert.IsTrue(a.include(tw));
            Assert.IsFalse(n.include(tw));
        }
Exemplo n.º 3
0
 public override bool include(TreeWalk walker)
 {
     return(!a.include(walker));
 }