예제 #1
0
        public void testAddTwo()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");
            Assert.IsTrue((flag1.Mask & flag2.Mask) == 0);

            var flagSet = new RevFlagSet();
            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));
            Assert.AreEqual(flag1.Mask | flag2.Mask, flagSet.Mask);
            Assert.AreEqual(2, flagSet.Count);
        }
예제 #2
0
        public void testEquals()
        {
            RevFlag flag1   = rw.newFlag("flag_1");
            RevFlag flag2   = rw.newFlag("flag_2");
            var     flagSet = new RevFlagSet();

            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));

            Assert.IsTrue(new RevFlagSet(flagSet).Equals(flagSet));
            Assert.IsTrue(new RevFlagSet(new[] { flag1, flag2 }).Equals(flagSet));
        }
예제 #3
0
        public void testAddTwo()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");

            Assert.IsTrue((flag1.Mask & flag2.Mask) == 0);

            var flagSet = new RevFlagSet();

            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));
            Assert.AreEqual(flag1.Mask | flag2.Mask, flagSet.Mask);
            Assert.AreEqual(2, flagSet.Count);
        }
예제 #4
0
        public virtual void testRemove()
        {
            RevFlag flag1   = rw.newFlag("flag_1");
            RevFlag flag2   = rw.newFlag("flag_2");
            var     flagSet = new RevFlagSet();

            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));

            Assert.IsTrue(flagSet.Remove(flag1));
            Assert.IsFalse(flagSet.Remove(flag1));
            Assert.AreEqual(flag2.Mask, flagSet.Mask);
            Assert.IsFalse(flagSet.Contains(flag1));
        }
예제 #5
0
 /**
  * Create a new filter that tests all flags in a set.
  * 
  * @param a
  *            set of flags to test.
  * @return filter that selects only commits with all flags in <code>a</code>.
  */
 public static RevFilter hasAll(params RevFlag[] a)
 {
     RevFlagSet set = new RevFlagSet();
     foreach (RevFlag flag in a)
         set.Add(flag);
     return new HasAll(set);
 }
예제 #6
0
        public void testAddOne()
        {
            const string flagName = "flag";
            RevFlag flag = rw.newFlag(flagName);
            Assert.IsTrue(0 != flag.Mask);
            Assert.AreSame(flagName, flag.Name);

            var flagSet = new RevFlagSet();
            Assert.IsTrue(flagSet.Add(flag));
            Assert.IsFalse(flagSet.Add(flag));
            Assert.AreEqual(flag.Mask, flagSet.Mask);
            Assert.AreEqual(1, flagSet.Count);
            var i = flagSet.GetEnumerator();
            Assert.IsTrue(i.MoveNext());
            Assert.AreSame(flag, i.Current);
            Assert.IsFalse(i.MoveNext());
        }
예제 #7
0
        public void testContainsAll()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");
            var     set1  = new RevFlagSet();

            Assert.IsTrue(set1.Add(flag1));
            Assert.IsTrue(set1.Add(flag2));

            Assert.IsTrue(set1.ContainsAll(set1));
            Assert.IsTrue(set1.ContainsAll(new[] { flag1, flag2 }));

            var set2 = new RevFlagSet {
                rw.newFlag("flag_3")
            };

            Assert.IsFalse(set1.ContainsAll(set2));
        }
예제 #8
0
        ///	<summary>
        /// Create a new filter that tests for any flag in a set.
        ///	</summary>
        ///	<param name="a">Set of flags to test. </param>
        ///	<returns>
        /// Filter that selects only commits with any flag in <code>a</code>.
        /// </returns>
        public static RevFilter hasAny(params RevFlag[] a)
        {
            var set = new RevFlagSet();

            foreach (RevFlag flag in a)
            {
                set.Add(flag);
            }
            return(new HasAny(set));
        }
예제 #9
0
        public void testAddOne()
        {
            const string flagName = "flag";
            RevFlag      flag     = rw.newFlag(flagName);

            Assert.IsTrue(0 != flag.Mask);
            Assert.AreSame(flagName, flag.Name);

            var flagSet = new RevFlagSet();

            Assert.IsTrue(flagSet.Add(flag));
            Assert.IsFalse(flagSet.Add(flag));
            Assert.AreEqual(flag.Mask, flagSet.Mask);
            Assert.AreEqual(1, flagSet.Count);
            var i = flagSet.GetEnumerator();

            Assert.IsTrue(i.MoveNext());
            Assert.AreSame(flag, i.Current);
            Assert.IsFalse(i.MoveNext());
        }
예제 #10
0
        public UploadPack(Repository copyFrom)
        {
            db = copyFrom;
            walk = new RevWalk.RevWalk(db);

            ADVERTISED = walk.newFlag("ADVERTISED");
            WANT = walk.newFlag("WANT");
            PEER_HAS = walk.newFlag("PEER_HAS");
            COMMON = walk.newFlag("COMMON");
            walk.carry(PEER_HAS);

            SAVE = new RevFlagSet();
            SAVE.Add(ADVERTISED);
            SAVE.Add(WANT);
            SAVE.Add(PEER_HAS);
        }
예제 #11
0
        public void testContainsAll()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");
            var set1 = new RevFlagSet();
            Assert.IsTrue(set1.Add(flag1));
            Assert.IsTrue(set1.Add(flag2));

            Assert.IsTrue(set1.ContainsAll(set1));
            Assert.IsTrue(set1.ContainsAll(new[] { flag1, flag2 }));

            var set2 = new RevFlagSet { rw.newFlag("flag_3") };
            Assert.IsFalse(set1.ContainsAll(set2));
        }
예제 #12
0
        public virtual void testRemove()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");
            var flagSet = new RevFlagSet();
            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));

            Assert.IsTrue(flagSet.Remove(flag1));
            Assert.IsFalse(flagSet.Remove(flag1));
            Assert.AreEqual(flag2.Mask, flagSet.Mask);
            Assert.IsFalse(flagSet.Contains(flag1));
        }
예제 #13
0
        public void testEquals()
        {
            RevFlag flag1 = rw.newFlag("flag_1");
            RevFlag flag2 = rw.newFlag("flag_2");
            var flagSet = new RevFlagSet();
            Assert.IsTrue(flagSet.Add(flag1));
            Assert.IsTrue(flagSet.Add(flag2));

            Assert.IsTrue(new RevFlagSet(flagSet).Equals(flagSet));
            Assert.IsTrue(new RevFlagSet(new[] { flag1, flag2 }).Equals(flagSet));
        }
예제 #14
0
 /**
  * Create a new filter that tests for a single flag.
  *
  * @param a
  *            the flag to test.
  * @return filter that selects only commits with flag <code>a</code>.
  */
 public static RevFilter has(RevFlag a)
 {
     RevFlagSet s = new RevFlagSet();
     s.Add(a);
     return new HasAll(s);
 }
예제 #15
0
		///	<summary>
		/// Create a new filter that tests for any flag in a set.
		///	</summary>
		///	<param name="a">Set of flags to test. </param>
		///	<returns>
		/// Filter that selects only commits with any flag in <code>a</code>.
		/// </returns>
		public static RevFilter hasAny(params RevFlag[] a)
		{
			var set = new RevFlagSet();
			foreach (RevFlag flag in a)
			{
				set.Add(flag);
			}
			return new HasAny(set);
		}