Пример #1
0
        public virtual void TestNegateIsUnwrap()
        {
            TreeFilter a = PathFilter.Create("a/b");
            TreeFilter n = NotTreeFilter.Create(a);

            NUnit.Framework.Assert.AreSame(a, n.Negate());
        }
Пример #2
0
        public virtual void TestShouldBeRecursive_PathFilter()
        {
            TreeFilter a = PathFilter.Create("a/b");

            NUnit.Framework.Assert.IsTrue(a.ShouldBeRecursive());
            TreeFilter n = NotTreeFilter.Create(a);

            NUnit.Framework.Assert.IsTrue(n.ShouldBeRecursive());
        }
 /// <summary>Create a collection of path filters from Java strings.</summary>
 /// <remarks>
 /// Create a collection of path filters from Java strings.
 /// <p>
 /// Path strings are relative to the root of the repository. If the user's
 /// input should be assumed relative to a subdirectory of the repository the
 /// caller must prepend the subdirectory's path prior to creating the filter.
 /// <p>
 /// Path strings use '/' to delimit directories on all platforms.
 /// <p>
 /// Paths may appear in any order. Sorting may be done internally when the
 /// group is constructed if doing so will improve path matching performance.
 /// </remarks>
 /// <param name="paths">the paths to test against. Must have at least one entry.</param>
 /// <returns>a new filter for the paths supplied.</returns>
 public static TreeFilter CreateFromStrings(params string[] paths)
 {
     if (paths.Length == 0)
     {
     throw new ArgumentException(JGitText.Get().atLeastOnePathIsRequired);
     }
     int length = paths.Length;
     PathFilter[] p = new PathFilter[length];
     for (int i = 0; i < length; i++)
     {
     p[i] = PathFilter.Create(paths[i]);
     }
     return Create(p);
 }
 /// <summary>Create a collection of path filters from Java strings.</summary>
 /// <remarks>
 /// Create a collection of path filters from Java strings.
 /// <p>
 /// Path strings are relative to the root of the repository. If the user's
 /// input should be assumed relative to a subdirectory of the repository the
 /// caller must prepend the subdirectory's path prior to creating the filter.
 /// <p>
 /// Path strings use '/' to delimit directories on all platforms.
 /// <p>
 /// Paths may appear in any order within the collection. Sorting may be done
 /// internally when the group is constructed if doing so will improve path
 /// matching performance.
 /// </remarks>
 /// <param name="paths">the paths to test against. Must have at least one entry.</param>
 /// <returns>a new filter for the list of paths supplied.</returns>
 public static TreeFilter CreateFromStrings(ICollection<string> paths)
 {
     if (paths.IsEmpty())
     {
     throw new ArgumentException(JGitText.Get().atLeastOnePathIsRequired);
     }
     PathFilter[] p = new PathFilter[paths.Count];
     int i = 0;
     foreach (string s in paths)
     {
     p[i++] = PathFilter.Create(s);
     }
     return Create(p);
 }