示例#1
0
        ///	<summary>
        /// Recursively add an entire tree into this builder.
        /// <para />
        /// If pathPrefix is "a/b" and the tree contains file "c" then the resulting
        /// DirCacheEntry will have the path "a/b/c".
        /// <para />
        /// All entries are inserted at stage 0, therefore assuming that the
        /// application will not insert any other paths with the same pathPrefix.
        /// </summary>
        /// <param name="pathPrefix">
        /// UTF-8 encoded prefix to mount the tree's entries at. If the
        /// path does not end with '/' one will be automatically inserted
        /// as necessary.
        /// </param>
        /// <param name="stage">Stage of the entries when adding them.</param>
        /// <param name="db">
        /// Repository the tree(s) will be read from during recursive
        /// traversal. This must be the same repository that the resulting
        /// <see cref="DirCache"/> would be written out to (or used in) otherwise
        /// the caller is simply asking for deferred MissingObjectExceptions.
        /// </param>
        /// <param name="tree">
        /// The tree to recursively add. This tree's contents will appear
        /// under <paramref name="pathPrefix"/>. The ObjectId must be that of a
        /// tree; the caller is responsible for dereferencing a tag or
        /// commit (if necessary).
        /// </param>
        /// <exception cref="IOException">
        /// A tree cannot be read to iterate through its entries.
        /// </exception>
        public void addTree(byte[] pathPrefix, int stage, Repository db, AnyObjectId tree)
        {
            var tw = new TreeWalk.TreeWalk(db);

            tw.reset();
            var curs = new WindowCursor();

            try
            {
                tw.addTree(new CanonicalTreeParser(pathPrefix, db, tree.ToObjectId(), curs));
            }
            finally
            {
                curs.Release();
            }
            tw.Recursive = true;

            if (!tw.next())
            {
                return;
            }

            DirCacheEntry newEntry = ToEntry(stage, tw);

            BeforeAdd(newEntry);
            FastAdd(newEntry);
            while (tw.next())
            {
                FastAdd(ToEntry(stage, tw));
            }
        }
示例#2
0
        /// <summary>
        /// Create a new pack indexer utility.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="src">
        /// stream to read the pack data from. If the stream is buffered
        /// use <see cref="BUFFER_SIZE"/> as the buffer size for the stream.
        /// </param>
        /// <param name="dstBase"></param>
        public IndexPack(Repository db, Stream src, FileInfo dstBase)
        {
            _repo           = db;
            _objectDatabase = db.ObjectDatabase.newCachedDatabase();
            _stream         = src;
            _inflater       = InflaterCache.Instance.get();
            _windowCursor   = new WindowCursor();
            _buffer         = new byte[BUFFER_SIZE];
            _objectData     = new byte[BUFFER_SIZE];
            _objectDigest   = Constants.newMessageDigest();
            _tempObjectId   = new MutableObjectId();
            _packDigest     = Constants.newMessageDigest();

            if (dstBase != null)
            {
                DirectoryInfo dir = dstBase.Directory;
                string        nam = dstBase.Name;
                _dstPack = PathUtil.CombineFilePath(dir, GetPackFileName(nam));
                _dstIdx  = PathUtil.CombineFilePath(dir, GetIndexFileName(nam));
                _packOut = _dstPack.Create();
            }
            else
            {
                _dstPack = null;
                _dstIdx  = null;
            }
        }
示例#3
0
        /// <summary>
        /// 设置光标;
        /// </summary>
        /// <exception cref="KeyNotFoundException"></exception>
        public static IDisposable SetCursor(string name)
        {
            name = name.ToLower();
            ICustomCursor cursor = cursors[name];

            return(WindowCursor.SetCursor(cursor));
        }
示例#4
0
        /// <summary>
        /// Create a new tree walker for a given repository.
        /// </summary>
        /// <param name="repo">
        /// The repository the walker will obtain data from.
        /// </param>
        public TreeWalk(Repository repo)
        {
            _idBuffer = new MutableObjectId();
            _cursor   = new WindowCursor();

            _db     = repo;
            _filter = TreeFilter.ALL;
            _trees  = new AbstractTreeIterator[] { new EmptyTreeIterator() };
        }
示例#5
0
        /// <summary>
        /// 设置光标;
        /// </summary>
        public static IDisposable SetCursor(ICustomCursor cursor)
        {
            if (cursor == null)
            {
                throw new ArgumentNullException(nameof(cursor));
            }

            return(WindowCursor.SetCursor(cursor));
        }
示例#6
0
        private void Test0()
        {
            var animatedCursorFactroy = new AnimatedCursorFactroy();

            using (var content = new SharpZipLibContent(Path.Combine(GameCursor.CursorsDirectory, "Wait.zip")))
            {
                animatedCursor = animatedCursorFactroy.Read(content);
            }

            WindowCursor.SetCursor(animatedCursor);
        }
示例#7
0
        /**
         * Reset this parser to walk through the given tree.
         *
         * @param repo
         *            repository to load the tree data from.
         * @param id
         *            identity of the tree being parsed; used only in exception
         *            messages if data corruption is found.
         * @param curs
         *            window cursor to use during repository access.
         * @return the root level parser.
         * @throws MissingObjectException
         *             the object supplied is not available from the repository.
         * @throws IncorrectObjectTypeException
         *             the object supplied as an argument is not actually a tree and
         *             cannot be parsed as though it were a tree.
         * @throws IOException
         *             a loose object or pack file could not be Read.
         */
        public CanonicalTreeParser resetRoot(Repository repo, AnyObjectId id, WindowCursor curs)
        {
            CanonicalTreeParser p = this;

            while (p.Parent != null)
            {
                p = (CanonicalTreeParser)p.Parent;
            }
            p.reset(repo, id, curs);
            return(p);
        }
示例#8
0
        public override AbstractTreeIterator createSubtreeIterator(Repository repo)
        {
            var curs = new WindowCursor();

            try
            {
                return(createSubtreeIterator(repo, new MutableObjectId(), curs));
            }
            finally
            {
                curs.Release();
            }
        }
示例#9
0
文件: Merger.cs 项目: kkl713/GitSharp
        ///	<summary>
        /// Open an iterator over a tree.
        /// </summary>
        /// <param name="treeId">
        /// the tree to scan; must be a tree (not a <see cref="Treeish"/>).
        /// </param>
        /// <returns>An iterator for the tree.</returns>
        /// <exception cref="IncorrectObjectTypeException">
        /// the input object is not a tree.
        /// </exception>
        /// <exception cref="IOException">
        /// the tree object is not found or cannot be read.
        /// </exception>
        protected AbstractTreeIterator OpenTree(AnyObjectId treeId)
        {
            var windowCursor = new WindowCursor();

            try
            {
                return(new CanonicalTreeParser(null, _db, treeId, windowCursor));
            }
            finally
            {
                windowCursor.Release();
            }
        }
示例#10
0
        /**
         * Reset this parser to walk through the given tree.
         *
         * @param repo
         *            repository to load the tree data from.
         * @param id
         *            identity of the tree being parsed; used only in exception
         *            messages if data corruption is found.
         * @param curs
         *            window cursor to use during repository access.
         * @throws MissingObjectException
         *             the object supplied is not available from the repository.
         * @throws IncorrectObjectTypeException
         *             the object supplied as an argument is not actually a tree and
         *             cannot be parsed as though it were a tree.
         * @throws IOException
         *             a loose object or pack file could not be Read.
         */
        public void reset(Repository repo, AnyObjectId id, WindowCursor curs)
        {
            ObjectLoader ldr = repo.OpenObject(curs, id);

            if (ldr == null)
            {
                ObjectId me = id.ToObjectId();
                throw new MissingObjectException(me, Constants.TYPE_TREE);
            }
            byte[] subtreeData = ldr.CachedBytes;
            if (ldr.Type != Constants.OBJ_TREE)
            {
                ObjectId me = id.ToObjectId();
                throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
            }
            reset(subtreeData);
        }
示例#11
0
 /**
  * Create a new iterator for the current entry's subtree.
  * <para />
  * The parent reference of the iterator must be <code>this</code>, otherwise
  * the caller would not be able to exit out of the subtree iterator
  * correctly and return to continue walking <code>this</code>.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param idBuffer
  *            temporary ObjectId buffer for use by this method.
  * @param curs
  *            window cursor to use during repository access.
  * @return a new parser that walks over the current subtree.
  * @throws IncorrectObjectTypeException
  *             the current entry is not actually a tree and cannot be parsed
  *             as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be Read.
  */
 public virtual AbstractTreeIterator createSubtreeIterator(Repository repo, MutableObjectId idBuffer, WindowCursor curs)
 {
     return(createSubtreeIterator(repo));
 }
示例#12
0
 /**
  * Recursively add an entire tree into this builder.
  * <p>
  * If pathPrefix is "a/b" and the tree contains file "c" then the resulting
  * DirCacheEntry will have the path "a/b/c".
  * <p>
  * All entries are inserted at stage 0, therefore assuming that the
  * application will not insert any other paths with the same pathPrefix.
  *
  * @param pathPrefix
  *            UTF-8 encoded prefix to mount the tree's entries at. If the
  *            path does not end with '/' one will be automatically inserted
  *            as necessary.
  * @param stage
  *            stage of the entries when adding them.
  * @param db
  *            repository the tree(s) will be read from during recursive
  *            traversal. This must be the same repository that the resulting
  *            DirCache would be written out to (or used in) otherwise the
  *            caller is simply asking for deferred MissingObjectExceptions.
  * @param tree
  *            the tree to recursively add. This tree's contents will appear
  *            under <code>pathPrefix</code>. The ObjectId must be that of a
  *            tree; the caller is responsible for dereferencing a tag or
  *            commit (if necessary).
  * @throws IOException
  *             a tree cannot be read to iterate through its entries.
  */
 public void addTree(byte[] pathPrefix, int stage, Repository db, AnyObjectId tree)
 {
     var tw = new TreeWalk.TreeWalk(db);
     tw.reset();
     var curs = new WindowCursor();
     try
     {
         tw.addTree(new CanonicalTreeParser(pathPrefix, db, tree.ToObjectId(), curs));
     }
     finally
     {
         curs.release();
     }
     tw.setRecursive(true);
     if (tw.next())
     {
         DirCacheEntry newEntry = toEntry(stage, tw);
         beforeAdd(newEntry);
         fastAdd(newEntry);
         while (tw.next())
             fastAdd(toEntry(stage, tw));
     }
 }
示例#13
0
        public IndexPack(Repository db, Stream src, FileInfo dstBase)
        {
            _repo = db;
            _stream = src;
            _crc = new Crc32();
            _inflater = InflaterCache.Instance.get();
            _windowCursor = new WindowCursor();
            _buffer = new byte[BUFFER_SIZE];
            _objectData = new byte[BUFFER_SIZE];
            _objectDigest = Constants.newMessageDigest();
            _tempObjectId = new MutableObjectId();
            _packDigest = Constants.newMessageDigest();

            if (dstBase != null)
            {
                DirectoryInfo dir = dstBase.Directory;
                string nam = dstBase.Name;
                _dstPack = new FileInfo(Path.Combine(dir.FullName, GetPackFileName(nam)));
                _dstIdx = new FileInfo(Path.Combine(dir.FullName, GetIndexFileName(nam)));
                _packOut = _dstPack.Create();
            }
            else
            {
                _dstPack = null;
                _dstIdx = null;
            }
        }
示例#14
0
        public void index(ProgressMonitor progress)
        {
            progress.Start(2 /* tasks */);
            try
            {
                try
                {
                    ReadPackHeader();

                    _entries = new PackedObjectInfo[(int)_objectCount];
                    _baseById = new ObjectIdSubclassMap<DeltaChain>();
                    _baseByPos = new LongMap<UnresolvedDelta>();

                    progress.BeginTask(PROGRESS_DOWNLOAD, (int)_objectCount);
                    for (int done = 0; done < _objectCount; done++)
                    {
                        IndexOneObject();
                        progress.Update(1);
                        if (progress.IsCancelled)
                        {
                            throw new IOException("Download cancelled");
                        }
                    }

                    ReadPackFooter();
                    EndInput();
                    progress.EndTask();

                    if (_deltaCount > 0)
                    {
                        if (_packOut == null)
                        {
                            throw new IOException("need packOut");
                        }

                        ResolveDeltas(progress);
                        if (_entryCount < _objectCount)
                        {
                            if (!_fixThin)
                            {
                                throw new IOException("pack has " + (_objectCount - _entryCount) + " unresolved deltas");
                            }

                            FixThinPack(progress);
                        }
                    }

                    if (_packOut != null && (_keepEmpty || _entryCount > 0))
                    {
                        _packOut.Flush();
                    }

                    _packDigest = null;
                    _baseById = null;
                    _baseByPos = null;

                    if (_dstIdx != null && (_keepEmpty || _entryCount > 0))
                    {
                        WriteIdx();
                    }
                }
                finally
                {
                    try
                    {
                        InflaterCache.Instance.release(_inflater);
                    }
                    finally
                    {
                        _inflater = null;
                    }
                    _windowCursor = WindowCursor.Release(_windowCursor);

                    progress.EndTask();
                    if (_packOut != null)
                    {
                        _packOut.Close();
                    }
                }

                if (_keepEmpty || _entryCount > 0)
                {
                    if (_dstPack != null)
                    {
                        _dstPack.IsReadOnly = true;
                    }
                    if (_dstIdx != null)
                    {
                        _dstIdx.IsReadOnly = true;
                    }
                }
            }
            catch (IOException)
            {
                if (_dstPack != null) _dstPack.Delete();
                if (_dstIdx != null) _dstIdx.Delete();
                throw;
            }
        }
示例#15
0
 /**
  * Create a new iterator for the current entry's subtree.
  * <p>
  * The parent reference of the iterator must be <code>this</code>, otherwise
  * the caller would not be able to exit out of the subtree iterator
  * correctly and return to continue walking <code>this</code>.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param idBuffer
  *            temporary ObjectId buffer for use by this method.
  * @param curs
  *            window cursor to use during repository access.
  * @return a new parser that walks over the current subtree.
  * @throws IncorrectObjectTypeException
  *             the current entry is not actually a tree and cannot be parsed
  *             as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public virtual AbstractTreeIterator createSubtreeIterator(Repository repo, MutableObjectId idBuffer, WindowCursor curs)
 {
     return createSubtreeIterator(repo);
 }
示例#16
0
 ///	<summary>
 /// Open an iterator over a tree.
 /// </summary>
 /// <param name="treeId">
 /// the tree to scan; must be a tree (not a <see cref="Treeish"/>).
 /// </param>
 /// <returns>An iterator for the tree.</returns>
 /// <exception cref="IncorrectObjectTypeException">
 /// the input object is not a tree.
 /// </exception>
 /// <exception cref="IOException">
 /// the tree object is not found or cannot be read.
 /// </exception>
 protected AbstractTreeIterator OpenTree(AnyObjectId treeId)
 {
     var windowCursor = new WindowCursor();
     try
     {
         return new CanonicalTreeParser(null, _db, treeId, windowCursor);
     }
     finally
     {
         windowCursor.Release();
     }
 }
示例#17
0
文件: Merger.cs 项目: gilran/GitSharp
	    /**
	     * Open an iterator over a tree.
	     *
	     * @param treeId
	     *            the tree to scan; must be a tree (not a treeish).
	     * @return an iterator for the tree.
	     * @throws IncorrectObjectTypeException
	     *             the input object is not a tree.
	     * @throws IOException
	     *             the tree object is not found or cannot be read.
	     */
	    protected AbstractTreeIterator OpenTree(AnyObjectId treeId)
        {
		    WindowCursor curs = new WindowCursor();
		    try 
            {
			    return new CanonicalTreeParser(null, Db, treeId, curs);
		    } 
            finally 
            {
			    curs.release();
		    }
	    }
示例#18
0
 /**
  * Reset this parser to walk through the given tree.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param id
  *            identity of the tree being parsed; used only in exception
  *            messages if data corruption is found.
  * @param curs
  *            window cursor to use during repository access.
  * @return the root level parser.
  * @throws MissingObjectException
  *             the object supplied is not available from the repository.
  * @throws IncorrectObjectTypeException
  *             the object supplied as an argument is not actually a tree and
  *             cannot be parsed as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public CanonicalTreeParser resetRoot(Repository repo, AnyObjectId id, WindowCursor curs)
 {
     CanonicalTreeParser p = this;
     while (p.parent != null)
         p = (CanonicalTreeParser)p.parent;
     p.reset(repo, id, curs);
     return p;
 }
示例#19
0
 // [henon] createSubtreeIterator0 <--- not a typo!
 /**
  * Back door to quickly create a subtree iterator for any subtree.
  * <p>
  * Don't use this unless you are ObjectWalk. The method is meant to be
  * called only once the current entry has been identified as a tree and its
  * identity has been converted into an ObjectId.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param id
  *            ObjectId of the tree to open.
  * @param curs
  *            window cursor to use during repository access.
  * @return a new parser that walks over the current subtree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public CanonicalTreeParser createSubtreeIterator0(Repository repo, AnyObjectId id, WindowCursor curs)
 {
     CanonicalTreeParser p = new CanonicalTreeParser(this);
     p.reset(repo, id, curs);
     return p;
 }
示例#20
0
 public new CanonicalTreeParser createSubtreeIterator(Repository repo, MutableObjectId idBuffer, WindowCursor curs)
 {
     idBuffer.FromRaw(this.idBuffer(), this.idOffset());
     if (!FileMode.Tree.Equals(mode))
     {
         ObjectId me = idBuffer.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     return createSubtreeIterator0(repo, idBuffer, curs);
 }
示例#21
0
        /// <summary>
        /// Consume data from the input stream until the packfile is indexed.
        /// </summary>
        /// <param name="progress">progress feedback</param>
        public void index(ProgressMonitor progress)
        {
            progress.Start(2 /* tasks */);
            try
            {
                try
                {
                    ReadPackHeader();

                    _entries   = new PackedObjectInfo[(int)_objectCount];
                    _baseById  = new ObjectIdSubclassMap <DeltaChain>();
                    _baseByPos = new LongMap <UnresolvedDelta>();

                    progress.BeginTask(PROGRESS_DOWNLOAD, (int)_objectCount);
                    for (int done = 0; done < _objectCount; done++)
                    {
                        IndexOneObject();
                        progress.Update(1);
                        if (progress.IsCancelled)
                        {
                            throw new IOException("Download cancelled");
                        }
                    }

                    ReadPackFooter();
                    EndInput();
                    progress.EndTask();

                    if (_deltaCount > 0)
                    {
                        if (_packOut == null)
                        {
                            throw new IOException("need packOut");
                        }
                        ResolveDeltas(progress);
                        if (_needBaseObjectIds)
                        {
                            _baseIds = new HashSet <ObjectId>();
                            foreach (var c in _baseById)
                            {
                                _baseIds.Add(c);
                            }
                        }
                        if (_entryCount < _objectCount)
                        {
                            if (!_fixThin)
                            {
                                throw new IOException("pack has " + (_objectCount - _entryCount) + " unresolved deltas");
                            }

                            FixThinPack(progress);
                        }
                    }

                    if (_packOut != null && (_keepEmpty || _entryCount > 0))
                    {
                        _packOut.Flush();
                    }

                    _packDigest = null;
                    _baseById   = null;
                    _baseByPos  = null;

                    if (_dstIdx != null && (_keepEmpty || _entryCount > 0))
                    {
                        WriteIdx();
                    }
                }
                finally
                {
                    try
                    {
                        InflaterCache.Instance.release(_inflater);
                    }
                    finally
                    {
                        _inflater = null;
                        _objectDatabase.close();
                    }
                    _windowCursor = WindowCursor.Release(_windowCursor);

                    progress.EndTask();
                    if (_packOut != null)
                    {
                        _packOut.Dispose();
                    }
                }

                if (_keepEmpty || _entryCount > 0)
                {
                    if (_dstPack != null)
                    {
                        _dstPack.IsReadOnly = true;
                    }
                    if (_dstIdx != null)
                    {
                        _dstIdx.IsReadOnly = true;
                    }
                }
            }
            catch (IOException)
            {
                if (_dstPack != null)
                {
                    _dstPack.DeleteFile();
                }
                if (_dstIdx != null)
                {
                    _dstIdx.DeleteFile();
                }
                throw;
            }
        }
示例#22
0
 internal Window(IntPtr ptr)
 {
     handle = ptr;
     Cursor = new WindowCursor(this);
 }
示例#23
0
		internal Window(IntPtr ptr)
		{
			handle = ptr;
			Cursor = new WindowCursor(this);
		}
示例#24
0
 public new CanonicalTreeParser createSubtreeIterator(Repository repo, MutableObjectId idBuffer, WindowCursor curs)
 {
     idBuffer.FromRaw(this.idBuffer(), idOffset());
     if (FileMode.Tree != EntryFileMode)
     {
         ObjectId me = idBuffer.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     return(createSubtreeIterator0(repo, idBuffer, curs));
 }
示例#25
0
 public new CanonicalTreeParser createSubtreeIterator(Repository repo, MutableObjectId idBuffer, WindowCursor curs)
 {
     if (idBuffer == null)
         throw new ArgumentNullException("idBuffer");
     idBuffer.FromRaw(this.idBuffer(), idOffset());
     if (FileMode.Tree != EntryFileMode)
     {
         ObjectId me = idBuffer.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     return createSubtreeIterator0(repo, idBuffer, curs);
 }
示例#26
0
 public override AbstractTreeIterator createSubtreeIterator(Repository repo)
 {
     WindowCursor curs = new WindowCursor();
     try
     {
         return createSubtreeIterator(repo, new MutableObjectId(), curs);
     }
     finally
     {
         curs.release();
     }
 }
示例#27
0
        /**
         * Back door to quickly Create a subtree iterator for any subtree.
         * <para />
         * Don't use this unless you are ObjectWalk. The method is meant to be
         * called only once the current entry has been identified as a tree and its
         * identity has been converted into an ObjectId.
         *
         * @param repo
         *            repository to load the tree data from.
         * @param id
         *            ObjectId of the tree to open.
         * @param curs
         *            window cursor to use during repository access.
         * @return a new parser that walks over the current subtree.
         * @throws IOException
         *             a loose object or pack file could not be Read.
         */
        public CanonicalTreeParser createSubtreeIterator0(Repository repo, AnyObjectId id, WindowCursor curs)         // [henon] createSubtreeIterator0 <--- not a typo!
        {
            var p = new CanonicalTreeParser(this);

            p.reset(repo, id, curs);
            return(p);
        }
示例#28
0
 /**
  * Reset this parser to walk through the given tree.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param id
  *            identity of the tree being parsed; used only in exception
  *            messages if data corruption is found.
  * @param curs
  *            window cursor to use during repository access.
  * @throws MissingObjectException
  *             the object supplied is not available from the repository.
  * @throws IncorrectObjectTypeException
  *             the object supplied as an argument is not actually a tree and
  *             cannot be parsed as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public void reset(Repository repo, AnyObjectId id, WindowCursor curs)
 {
     ObjectLoader ldr = repo.openObject(curs, id);
     if (ldr == null)
     {
         ObjectId me = id.ToObjectId();
         throw new MissingObjectException(me, Constants.TYPE_TREE);
     }
     byte[] subtreeData = ldr.getCachedBytes();
     if (ldr.getType() != Constants.OBJ_TREE)
     {
         ObjectId me = id.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     reset(subtreeData);
 }
示例#29
0
 /**
  * Create a new parser for a tree appearing in a subset of a repository.
  *
  * @param prefix
  *            position of this iterator in the repository tree. The value
  *            may be null or the empty array to indicate the prefix is the
  *            root of the repository. A trailing slash ('/') is
  *            automatically appended if the prefix does not end in '/'.
  * @param repo
  *            repository to load the tree data from.
  * @param treeId
  *            identity of the tree being parsed; used only in exception
  *            messages if data corruption is found.
  * @param curs
  *            a window cursor to use during data access from the repository.
  * @throws MissingObjectException
  *             the object supplied is not available from the repository.
  * @throws IncorrectObjectTypeException
  *             the object supplied as an argument is not actually a tree and
  *             cannot be parsed as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be Read.
  */
 public CanonicalTreeParser(byte[] prefix, Repository repo, AnyObjectId treeId, WindowCursor curs)
     : base(prefix)
 {
     reset(repo, treeId, curs);
 }
示例#30
0
 /**
  * Create a new parser for a tree appearing in a subset of a repository.
  *
  * @param prefix
  *            position of this iterator in the repository tree. The value
  *            may be null or the empty array to indicate the prefix is the
  *            root of the repository. A trailing slash ('/') is
  *            automatically appended if the prefix does not end in '/'.
  * @param repo
  *            repository to load the tree data from.
  * @param treeId
  *            identity of the tree being parsed; used only in exception
  *            messages if data corruption is found.
  * @param curs
  *            a window cursor to use during data access from the repository.
  * @throws MissingObjectException
  *             the object supplied is not available from the repository.
  * @throws IncorrectObjectTypeException
  *             the object supplied as an argument is not actually a tree and
  *             cannot be parsed as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public CanonicalTreeParser(byte[] prefix, Repository repo, AnyObjectId treeId, WindowCursor curs)
     : base(prefix)
 {
     reset(repo, treeId, curs);
 }
示例#31
0
 /**
  * Back door to quickly Create a subtree iterator for any subtree.
  * <para />
  * Don't use this unless you are ObjectWalk. The method is meant to be
  * called only once the current entry has been identified as a tree and its
  * identity has been converted into an ObjectId.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param id
  *            ObjectId of the tree to open.
  * @param curs
  *            window cursor to use during repository access.
  * @return a new parser that walks over the current subtree.
  * @throws IOException
  *             a loose object or pack file could not be Read.
  */
 public CanonicalTreeParser createSubtreeIterator0(Repository repo, AnyObjectId id, WindowCursor curs) // [henon] createSubtreeIterator0 <--- not a typo!
 {
     var p = new CanonicalTreeParser(this);
     p.reset(repo, id, curs);
     return p;
 }