コード例 #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
        private void Push(Candidate.BlobCandidate toInsert)
        {
            Candidate c = queue;

            if (c != null)
            {
                c.regionList    = null;
                toInsert.parent = c;
            }
            queue = toInsert;
        }
コード例 #3
0
 /// <summary>Push a candidate blob onto the generator's traversal stack.</summary>
 /// <remarks>
 /// Push a candidate blob 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="contents">contents of the file.</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, RawText contents
                                               )
 {
     if (description == null)
     {
         description = JGitText.Get().blameNotCommittedYet;
     }
     Candidate.BlobCandidate c = new Candidate.BlobCandidate(description, resultPath);
     c.sourceText = contents;
     c.regionList = new Region(0, 0, contents.Size());
     remaining    = contents.Size();
     Push(c);
     return(this);
 }