コード例 #1
0
ファイル: RevObjectTest.cs プロジェクト: ststeiger/ngit-core
        public virtual void TestHasRevFlag()
        {
            RevCommit a = Commit();

            NUnit.Framework.Assert.IsFalse(a.Has(RevFlag.UNINTERESTING));
            a.flags |= RevWalk.UNINTERESTING;
            NUnit.Framework.Assert.IsTrue(a.Has(RevFlag.UNINTERESTING));
        }
コード例 #2
0
        public virtual void TestCull()
        {
            RevBlob   f1 = Blob("1");
            RevBlob   f2 = Blob("2");
            RevBlob   f3 = Blob("3");
            RevBlob   f4 = Blob("4");
            RevTree   ta = Tree(File("a/1", f1), File("c/3", f3));
            RevCommit a  = Commit(ta);
            RevTree   tb = Tree(File("a/1", f2), File("c/3", f3));
            RevCommit b1 = Commit(tb, a);
            RevCommit b2 = Commit(tb, b1);
            RevTree   tc = Tree(File("a/1", f4));
            RevCommit c1 = Commit(tc, a);
            RevCommit c2 = Commit(tc, c1);

            MarkStart(b2);
            MarkUninteresting(c2);
            AssertCommit(b2, objw.Next());
            AssertCommit(b1, objw.Next());
            NUnit.Framework.Assert.IsNull(objw.Next());
            NUnit.Framework.Assert.IsTrue(a.Has(RevFlag.UNINTERESTING));
            NUnit.Framework.Assert.IsTrue(ta.Has(RevFlag.UNINTERESTING));
            NUnit.Framework.Assert.IsTrue(f1.Has(RevFlag.UNINTERESTING));
            NUnit.Framework.Assert.IsTrue(f3.Has(RevFlag.UNINTERESTING));
            NUnit.Framework.Assert.AreSame(tb, objw.NextObject());
            NUnit.Framework.Assert.AreSame(Get(tb, "a"), objw.NextObject());
            NUnit.Framework.Assert.AreSame(f2, objw.NextObject());
            NUnit.Framework.Assert.IsNull(objw.NextObject());
        }
コード例 #3
0
 /// <summary>Add a commit if it does not have a flag set yet, then set the flag.</summary>
 /// <remarks>
 /// Add a commit if it does not have a flag set yet, then set the flag.
 /// <p>
 /// This method permits the application to test if the commit has the given
 /// flag; if it does not already have the flag than the commit is added to
 /// the queue and the flag is set. This later will prevent the commit from
 /// being added twice.
 /// </remarks>
 /// <param name="c">commit to add.</param>
 /// <param name="queueControl">flag that controls admission to the queue.</param>
 public void Add(RevCommit c, RevFlag queueControl)
 {
     if (!c.Has(queueControl))
     {
         c.Add(queueControl);
         Add(c);
     }
 }
コード例 #4
0
ファイル: AbstractRevQueue.cs プロジェクト: LunarLanding/ngit
		/// <summary>Add a commit if it does not have a flag set yet, then set the flag.</summary>
		/// <remarks>
		/// Add a commit if it does not have a flag set yet, then set the flag.
		/// <p>
		/// This method permits the application to test if the commit has the given
		/// flag; if it does not already have the flag than the commit is added to
		/// the queue and the flag is set. This later will prevent the commit from
		/// being added twice.
		/// </remarks>
		/// <param name="c">commit to add.</param>
		/// <param name="queueControl">flag that controls admission to the queue.</param>
		public void Add(RevCommit c, RevFlag queueControl)
		{
			if (!c.Has(queueControl))
			{
				c.Add(queueControl);
				Add(c);
			}
		}
コード例 #5
0
 // Never happen. The filter we use does not throw any
 // exceptions, for any reason.
 /// <summary>Find the next commit that has the given flag set.</summary>
 /// <remarks>Find the next commit that has the given flag set.</remarks>
 /// <param name="flag">the flag to test commits against.</param>
 /// <param name="begin">
 /// first commit index to test at. Applications may wish to begin
 /// at 0, to test the first commit in the list.
 /// </param>
 /// <returns>
 /// index of the first commit at or after index <code>begin</code>
 /// that has the specified flag set on it; -1 if no match is found.
 /// </returns>
 public virtual int IndexOf(RevFlag flag, int begin)
 {
     while (begin < Count)
     {
         int index            = begin;
         RevObjectListBlock s = contents;
         while (s.shift > 0)
         {
             int i = index >> s.shift;
             index -= i << s.shift;
             s      = (RevObjectListBlock)s.contents[i];
         }
         while (begin++ < Count && index < BLOCK_SIZE)
         {
             RevCommit c = (RevCommit)s.contents[index++];
             if (c.Has(flag))
             {
                 return(begin);
             }
         }
     }
     return(-1);
 }
コード例 #6
0
 /// <summary>Find the next commit that has the given flag set.</summary>
 /// <remarks>Find the next commit that has the given flag set.</remarks>
 /// <param name="flag">the flag to test commits against.</param>
 /// <param name="begin">
 /// first commit index to test at. Applications may wish to begin
 /// at <code>size()-1</code>, to test the last commit in the
 /// list.
 /// </param>
 /// <returns>
 /// index of the first commit at or before index <code>begin</code>
 /// that has the specified flag set on it; -1 if no match is found.
 /// </returns>
 public virtual int LastIndexOf(RevFlag flag, int begin)
 {
     begin = Math.Min(begin, Count - 1);
     while (begin >= 0)
     {
         int index            = begin;
         RevObjectListBlock s = contents;
         while (s.shift > 0)
         {
             int i = index >> s.shift;
             index -= i << s.shift;
             s      = (RevObjectListBlock)s.contents[i];
         }
         while (begin-- >= 0 && index >= 0)
         {
             RevCommit c = (RevCommit)s.contents[index--];
             if (c.Has(flag))
             {
                 return(begin);
             }
         }
     }
     return(-1);
 }
コード例 #7
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private void PushLocalCommit(RevCommit p)
		{
			if (p.Has(LOCALLY_SEEN))
			{
				return;
			}
			revWalk.ParseHeaders(p);
			p.Add(LOCALLY_SEEN);
			p.Add(COMPLETE);
			p.Carry(COMPLETE);
			localCommitQueue.Add(p);
		}