示例#1
0
        /// <summary>Push a candidate object onto the generator's traversal stack.</summary>
        /// <remarks>
        /// Push a candidate object onto the generator's traversal stack.
        /// <p>
        /// Candidates should be pushed in history order from oldest-to-newest.
        /// Applications should push the starting commit first, then the index
        /// revision (if the index is interesting), and finally the working tree copy
        /// (if the working tree is interesting).
        /// </remarks>
        /// <param name="description">description of the blob revision, such as "Working Tree".
        ///     </param>
        /// <param name="id">may be a commit or a blob.</param>
        /// <returns>
        ///
        /// <code>this</code>
        /// </returns>
        /// <exception cref="System.IO.IOException">the repository cannot be read.</exception>
        public virtual NGit.Blame.BlameGenerator Push(string description, AnyObjectId id)
        {
            ObjectLoader ldr = reader.Open(id);

            if (ldr.GetType() == Constants.OBJ_BLOB)
            {
                if (description == null)
                {
                    description = JGitText.Get().blameNotCommittedYet;
                }
                Candidate.BlobCandidate c = new Candidate.BlobCandidate(description, resultPath);
                c.sourceBlob = id.ToObjectId();
                c.sourceText = new RawText(ldr.GetCachedBytes(int.MaxValue));
                c.regionList = new Region(0, 0, c.sourceText.Size());
                remaining    = c.sourceText.Size();
                Push(c);
                return(this);
            }
            RevCommit commit = revPool.ParseCommit(id);

            if (!Find(commit, resultPath))
            {
                return(this);
            }
            Candidate c_1 = new Candidate(commit, resultPath);

            c_1.sourceBlob = idBuf.ToObjectId();
            c_1.LoadText(reader);
            c_1.regionList = new Region(0, 0, c_1.sourceText.Size());
            remaining      = c_1.sourceText.Size();
            Push(c_1);
            return(this);
        }
示例#2
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));
 }
示例#3
0
 /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public override AbstractTreeIterator CreateSubtreeIterator(ObjectReader reader, MutableObjectId
                                                            idBuffer)
 {
     idBuffer.FromRaw(IdBuffer, IdOffset);
     if (!FileMode.TREE.Equals(mode))
     {
         ObjectId me = idBuffer.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     return(CreateSubtreeIterator0(reader, idBuffer));
 }
示例#4
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);
 }
示例#5
0
文件: PackIndex.cs 项目: shoff/ngit
 /// <returns>a copy of the object id.</returns>
 public virtual ObjectId ToObjectId()
 {
     EnsureId();
     return(idBuffer.ToObjectId());
 }
示例#6
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);
 }