forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFollowFilter.cs
More file actions
56 lines (50 loc) · 1.67 KB
/
FollowFilter.cs
File metadata and controls
56 lines (50 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
namespace LibGit2Sharp
{
/// <summary>
/// Criteria used to order the commits of the repository when querying its history.
/// <para>
/// The commits will be enumerated from the current HEAD of the repository.
/// </para>
/// </summary>
public sealed class FollowFilter
{
private static readonly List<CommitSortStrategies> AllowedSortStrategies = new List<CommitSortStrategies>
{
CommitSortStrategies.Topological,
CommitSortStrategies.Time,
CommitSortStrategies.Topological | CommitSortStrategies.Time
};
private CommitSortStrategies _sortBy;
/// <summary>
/// Initializes a new instance of <see cref="FollowFilter" />.
/// </summary>
public FollowFilter()
{
SortBy = CommitSortStrategies.Time;
}
/// <summary>
/// The ordering strategy to use.
/// <para>
/// By default, the commits are shown in reverse chronological order.
/// </para>
/// <para>
/// Only 'Topological', 'Time', or 'Topological | Time' are allowed.
/// </para>
/// </summary>
public CommitSortStrategies SortBy
{
get { return _sortBy; }
set
{
if (!AllowedSortStrategies.Contains(value))
{
throw new ArgumentException("Unsupported sort strategy. Only 'Topological', 'Time', or 'Topological | Time' are allowed.",
"value");
}
_sortBy = value;
}
}
}
}