Пример #1
0
        public virtual void TestRemoveRevFlag()
        {
            RevCommit a     = Commit();
            RevFlag   flag1 = rw.NewFlag("flag1");
            RevFlag   flag2 = rw.NewFlag("flag2");

            a.Add(flag1);
            a.Add(flag2);
            NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask, a.flags);
            a.Remove(flag2);
            NUnit.Framework.Assert.AreEqual(flag1.mask, a.flags);
        }
Пример #2
0
        /// <summary>Apply a flag to all commits matching the specified filter.</summary>
        /// <remarks>
        /// Apply a flag to all commits matching the specified filter.
        /// <p>
        /// This version allows incremental testing and application, such as from a
        /// background thread that needs to periodically halt processing and send
        /// updates to the UI.
        /// </remarks>
        /// <param name="matching">
        /// the filter to test commits with. If the filter includes a
        /// commit it will have the flag set; if the filter does not
        /// include the commit the flag will be unset.
        /// </param>
        /// <param name="flag">
        /// the flag to apply (or remove). Applications are responsible
        /// for allocating this flag from the source RevWalk.
        /// </param>
        /// <param name="rangeBegin">
        /// first commit within the list to begin testing at, inclusive.
        /// Must not be negative, but may be beyond the end of the list.
        /// </param>
        /// <param name="rangeEnd">
        /// last commit within the list to end testing at, exclusive. If
        /// smaller than or equal to <code>rangeBegin</code> then no
        /// commits will be tested.
        /// </param>
        /// <exception cref="System.IO.IOException">
        /// revision filter needed to read additional objects, but an
        /// error occurred while reading the pack files or loose objects
        /// of the repository.
        /// </exception>
        /// <exception cref="NGit.Errors.IncorrectObjectTypeException">
        /// revision filter needed to read additional objects, but an
        /// object was not of the correct type. Repository corruption may
        /// have occurred.
        /// </exception>
        /// <exception cref="NGit.Errors.MissingObjectException">
        /// revision filter needed to read additional objects, but an
        /// object that should be present was not found. Repository
        /// corruption may have occurred.
        /// </exception>
        public virtual void ApplyFlag(RevFilter matching, RevFlag flag, int rangeBegin, int
                                      rangeEnd)
        {
            RevWalk w = flag.GetRevWalk();

            rangeEnd = Math.Min(rangeEnd, Count);
            while (rangeBegin < rangeEnd)
            {
                int index            = rangeBegin;
                RevObjectListBlock s = contents;
                while (s.shift > 0)
                {
                    int i = index >> s.shift;
                    index -= i << s.shift;
                    s      = (RevObjectListBlock)s.contents[i];
                }
                while (rangeBegin++ < rangeEnd && index < BLOCK_SIZE)
                {
                    RevCommit c = (RevCommit)s.contents[index++];
                    if (matching.Include(w, c))
                    {
                        c.Add(flag);
                    }
                    else
                    {
                        c.Remove(flag);
                    }
                }
            }
        }
 /// <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
        public virtual void TestAddRevFlagSet()
        {
            RevCommit  a     = Commit();
            RevFlag    flag1 = rw.NewFlag("flag1");
            RevFlag    flag2 = rw.NewFlag("flag2");
            RevFlagSet s     = new RevFlagSet();

            s.AddItem(flag1);
            s.AddItem(flag2);
            NUnit.Framework.Assert.AreEqual(0, a.flags);
            a.Add(s);
            NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask, a.flags);
        }
Пример #5
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);
		}
Пример #6
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);
     }
 }