本文整理汇总了C#中RevFlagSet.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# RevFlagSet.AddItem方法的具体用法?C# RevFlagSet.AddItem怎么用?C# RevFlagSet.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevFlagSet
的用法示例。
在下文中一共展示了RevFlagSet.AddItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAddOne
public virtual void TestAddOne()
{
string flagName = "flag";
RevFlag flag = rw.NewFlag(flagName);
NUnit.Framework.Assert.IsTrue(0 != flag.mask);
NUnit.Framework.Assert.AreSame(flagName, flag.name);
RevFlagSet set = new RevFlagSet();
NUnit.Framework.Assert.IsTrue(set.AddItem(flag));
NUnit.Framework.Assert.IsFalse(set.AddItem(flag));
NUnit.Framework.Assert.AreEqual(flag.mask, set.mask);
NUnit.Framework.Assert.AreEqual(1, set.Count);
Iterator<RevFlag> i = set.Iterator();
NUnit.Framework.Assert.IsTrue(i.HasNext());
NUnit.Framework.Assert.AreSame(flag, i.Next());
NUnit.Framework.Assert.IsFalse(i.HasNext());
}
示例2: HasAllFilter
/// <summary>Create a new filter that tests all flags in a set.</summary>
/// <remarks>Create a new filter that tests all flags in a set.</remarks>
/// <param name="a">set of flags to test.</param>
/// <returns>filter that selects only commits with all flags in <code>a</code>.</returns>
public static RevFilter HasAllFilter(params RevFlag[] a)
{
RevFlagSet set = new RevFlagSet();
foreach (RevFlag flag in a)
{
set.AddItem(flag);
}
return new RevFlagFilter.HasAll(set);
}
示例3: UploadPack
/// <summary>Create a new pack upload for an open repository.</summary>
/// <remarks>Create a new pack upload for an open repository.</remarks>
/// <param name="copyFrom">the source repository.</param>
public UploadPack(Repository copyFrom)
{
db = copyFrom;
walk = new RevWalk(db);
walk.SetRetainBody(false);
WANT = walk.NewFlag("WANT");
PEER_HAS = walk.NewFlag("PEER_HAS");
COMMON = walk.NewFlag("COMMON");
SATISFIED = walk.NewFlag("SATISFIED");
walk.Carry(PEER_HAS);
SAVE = new RevFlagSet();
SAVE.AddItem(WANT);
SAVE.AddItem(PEER_HAS);
SAVE.AddItem(COMMON);
SAVE.AddItem(SATISFIED);
}
示例4: TestContainsAll
public virtual void TestContainsAll()
{
RevFlag flag1 = rw.NewFlag("flag_1");
RevFlag flag2 = rw.NewFlag("flag_2");
RevFlagSet set1 = new RevFlagSet();
NUnit.Framework.Assert.IsTrue(set1.AddItem(flag1));
NUnit.Framework.Assert.IsTrue(set1.AddItem(flag2));
NUnit.Framework.Assert.IsTrue(set1.ContainsAll(set1));
NUnit.Framework.Assert.IsTrue(set1.ContainsAll(Arrays.AsList(new RevFlag[] { flag1
, flag2 })));
RevFlagSet set2 = new RevFlagSet();
set2.AddItem(rw.NewFlag("flag_3"));
NUnit.Framework.Assert.IsFalse(set1.ContainsAll(set2));
}
示例5: TestAddTwo
public virtual void TestAddTwo()
{
RevFlag flag1 = rw.NewFlag("flag_1");
RevFlag flag2 = rw.NewFlag("flag_2");
NUnit.Framework.Assert.AreEqual(0, (flag1.mask & flag2.mask));
RevFlagSet set = new RevFlagSet();
NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask, set.mask);
NUnit.Framework.Assert.AreEqual(2, set.Count);
}
示例6: TestContains
public virtual void TestContains()
{
RevFlag flag1 = rw.NewFlag("flag_1");
RevFlag flag2 = rw.NewFlag("flag_2");
RevFlagSet set = new RevFlagSet();
set.AddItem(flag1);
NUnit.Framework.Assert.IsTrue(set.Contains(flag1));
NUnit.Framework.Assert.IsFalse(set.Contains(flag2));
NUnit.Framework.Assert.IsFalse(set.Contains("bob"));
}
示例7: TestRemove
public virtual void TestRemove()
{
RevFlag flag1 = rw.NewFlag("flag_1");
RevFlag flag2 = rw.NewFlag("flag_2");
RevFlagSet set = new RevFlagSet();
NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
NUnit.Framework.Assert.IsTrue(set.Remove(flag1));
NUnit.Framework.Assert.IsFalse(set.Remove(flag1));
NUnit.Framework.Assert.AreEqual(flag2.mask, set.mask);
NUnit.Framework.Assert.IsFalse(set.Contains(flag1));
}
示例8: TestEquals
public virtual void TestEquals()
{
RevFlag flag1 = rw.NewFlag("flag_1");
RevFlag flag2 = rw.NewFlag("flag_2");
RevFlagSet set = new RevFlagSet();
NUnit.Framework.Assert.IsTrue(set.AddItem(flag1));
NUnit.Framework.Assert.IsTrue(set.AddItem(flag2));
NUnit.Framework.Assert.AreEqual(set, new RevFlagSet(set));
NUnit.Framework.Assert.IsTrue(new RevFlagSet(Arrays.AsList(new RevFlag[] { flag1,
flag2 })).Equals(set));
}
示例9: Has
/// <summary>Create a new filter that tests for a single flag.</summary>
/// <remarks>Create a new filter that tests for a single flag.</remarks>
/// <param name="a">the flag to test.</param>
/// <returns>filter that selects only commits with flag <code>a</code>.</returns>
public static RevFilter Has(RevFlag a)
{
RevFlagSet s = new RevFlagSet();
s.AddItem(a);
return new RevFlagFilter.HasAll(s);
}
示例10: TestRemoveRevFlagSet
public virtual void TestRemoveRevFlagSet()
{
RevCommit a = Commit();
RevFlag flag1 = rw.NewFlag("flag1");
RevFlag flag2 = rw.NewFlag("flag2");
RevFlag flag3 = rw.NewFlag("flag3");
RevFlagSet s = new RevFlagSet();
s.AddItem(flag1);
s.AddItem(flag2);
a.Add(flag3);
a.Add(s);
NUnit.Framework.Assert.AreEqual(flag1.mask | flag2.mask | flag3.mask, a.flags);
a.Remove(s);
NUnit.Framework.Assert.AreEqual(flag3.mask, a.flags);
}
示例11: TestHasAllFlag
public virtual void TestHasAllFlag()
{
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.IsFalse(a.HasAll(s));
a.flags |= flag1.mask;
NUnit.Framework.Assert.IsFalse(a.HasAll(s));
a.flags |= flag2.mask;
NUnit.Framework.Assert.IsTrue(a.HasAll(s));
}