8000 Rename CommitCollection to CommitLog · Folcon/libgit2sharp@d422a6e · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit d422a6e

Browse files
committed
Rename CommitCollection to CommitLog
1 parent 68fb1c7 commit d422a6e

File tree

7 files changed

+42
-27
lines changed

7 files changed

+42
-27
lines changed

LibGit2Sharp.Tests/CommitFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ private static void AssertEnumerationOfCommits(Func<Repository, Filter> filterBu
341341

342342
private static void AssertEnumerationOfCommitsInRepo(Repository repo, Func<Repository, Filter> filterBuilder, IEnumerable<string> abbrevIds)
343343
{
344-
ICommitCollection commits = repo.Commits.QueryBy(filterBuilder(repo));
344+
ICommitLog commits = repo.Commits.QueryBy(filterBuilder(repo));
345345

346346
IEnumerable<string> commitShas = commits.Select(c => c.Id.ToString(7)).ToArray();
347347

LibGit2Sharp/Branch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public Commit Tip
125125
/// <summary>
126126
/// Gets the commits on this branch. (Starts walking from the References's target).
127127
/// </summary>
128-
public ICommitCollection Commits
128+
public ICommitLog Commits
129129
{
130130
get { return repo.Commits.QueryBy(new Filter { Since = this }); }
131131
}

LibGit2Sharp/CommitCollection.cs renamed to LibGit2Sharp/CommitLog.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@
99
namespace LibGit2Sharp
1010
{
1111
/// <summary>
12-
/// A collection of commits in a <see cref = "Repository" />
12+
/// A log of commits in a <see cref = "Repository" />
1313
/// </summary>
14-
public class CommitCollection : IQueryableCommitCollection
14+
public class CommitLog : IQueryableCommitLog
1515
{
1616
private readonly Repository repo;
1717
private IList<object> includedIdentifier = new List<object> { "HEAD" };
1818
private IList<object> excludedIdentifier = new List<object>();
1919
private readonly GitSortOptions sortOptions;
2020

2121
/// <summary>
22-
/// Initializes a new instance of the <see cref = "CommitCollection" /> class.
22+
/// Initializes a new instance of the <see cref = "CommitLog" /> class.
2323
/// The commits will be enumerated according in reverse chronological order.
2424
/// </summary>
2525
/// <param name = "repo">The repository.</param>
26-
internal CommitCollection(Repository repo)
26+
internal CommitLog(Repository repo)
2727
: this(repo, GitSortOptions.Time)
2828
{
2929
}
3030

3131
/// <summary>
32-
/// Initializes a new instance of the <see cref = "CommitCollection" /> class.
32+
/// Initializes a new instance of the <see cref = "CommitLog" /> class.
3333
/// </summary>
3434
/// <param name = "repo">The repository.</param>
3535
/// <param name = "sortingStrategy">The sorting strategy which should be applied when enumerating the commits.</param>
36-
internal CommitCollection(Repository repo, GitSortOptions sortingStrategy)
36+
internal CommitLog(Repository repo, GitSortOptions sortingStrategy)
3737
{
3838
this.repo = repo;
3939
sortOptions = sortingStrategy;
4040
}
4141

4242
/// <summary>
43-
/// Gets the current sorting strategy applied when enumerating the collection
43+
/// Gets the current sorting strategy applied when enumerating the log
4444
/// </summary>
4545
public GitSortOptions SortedBy
4646
{
@@ -50,9 +50,9 @@ public GitSortOptions SortedBy
5050
#region IEnumerable<Commit> Members
5151

5252
/// <summary>
53-
/// Returns an enumerator that iterates through the collection.
53+
/// Returns an enumerator that iterates through the log.
5454
/// </summary>
55-
/// <returns>An <see cref = "IEnumerator{T}" /> object that can be used to iterate through the collection.</returns>
55+
/// <returns>An <see cref = "IEnumerator{T}" /> object that can be used to iterate through the log.</returns>
5656
public IEnumerator<Commit> GetEnumerator()
5757
{
5858
if ((repo.Info.IsEmpty) && includedIdentifier.Any(o => PointsAtTheHead(o.ToString()))) // TODO: ToString() == fragile
@@ -64,9 +64,9 @@ public IEnumerator<Commit> GetEnumerator()
6464
}
6565

6666
/// <summary>
67-
/// Returns an enumerator that iterates through the collection.
67+
/// Returns an enumerator that iterates through the log.
6868
/// </summary>
69-
/// <returns>An <see cref = "IEnumerator" /> object that can be used to iterate through the collection.</returns>
69+
/// <returns>An <see cref = "IEnumerator" /> object that can be used to iterate through the log.</returns>
7070
IEnumerator IEnumerable.GetEnumerator()
7171
{
7272
return GetEnumerator();
@@ -78,14 +78,14 @@ IEnumerator IEnumerable.GetEnumerator()
7878
/// Returns the list of commits of the repository matching the specified <paramref name = "filter" />.
7979
/// </summary>
8080
/// <param name = "filter">The options used to control which commits will be returned.</param>
81-
/// <returns>A collection of commits, ready to be enumerated.</returns>
82-
public ICommitCollection QueryBy(Filter filter)
81+
/// <returns>A list of commits, ready to be enumerated.</returns>
82+
public ICommitLog QueryBy(Filter filter)
8383
{
8484
Ensure.ArgumentNotNull(filter, "filter");
8585
Ensure.ArgumentNotNull(filter.Since, "filter.Since");
8686
Ensure.ArgumentNotNullOrEmptyString(filter.Since.ToString(), "filter.Since");
8787

88-
return new CommitCollection(repo, filter.SortBy)
88+
return new CommitLog(repo, filter.SortBy)
8989
{
9090
includedIdentifier = ToList(filter.Since),
9191
excludedIdentifier = ToList(filter.Until)

LibGit2Sharp/ICommitCollection.cs renamed to LibGit2Sharp/ICommitLog.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23

34
namespace LibGit2Sharp
45
{
6+
/// <summary>
7+
/// A log of commits in a <see cref = "Repository" />.
8+
/// </summary>
9+
public interface ICommitLog : ICommitCollection
10+
{ }
11+
512
/// <summary>
613
/// A collection of commits in a <see cref = "Repository" />.
714
/// </summary>
15+
[Obsolete("This interface will be removed in the next release. Please use ICommitLog instead.")]
816
public interface ICommitCollection : IEnumerable<Commit>
917
{
1018
/// <summary>
11-
/// Gets the current sorting strategy applied when enumerating the collection.
19+
/// Gets the current sorting strategy applied when enumerating the log.
1220
/// </summary>
1321
GitSortOptions SortedBy { get; }
1422
}

LibGit2Sharp/IQueryableCommitCollection.cs renamed to LibGit2Sharp/IQueryableCommitLog.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33

44
namespace LibGit2Sharp
55
{
6+
/// <summary>
7+
/// A log of commits in a <see cref = "Repository" /> that can be filtered with queries.
8+
/// </summary>
9+
public interface IQueryableCommitLog : ICommitLog, IQueryableCommitCollection
10+
{ }
11+
612
/// <summary>
713
/// A collection of commits in a <see cref = "Repository" /> that can be filtered with queries.
814
/// </summary>
9-
public interface IQueryableCommitCollection : ICommitCollection //TODO: Find a name that's more explicit than IQueryableCommitCollection
15+
[Obsolete("This interface will be removed in the next release. Please use IQueryableCommitLog instead.")]
16+
public interface IQueryableCommitCollection : ICommitCollection
1017
{
1118
/// <summary>
1219
/// Returns the list of commits of the repository matching the specified <paramref name = "filter" />.
1320
/// </summary>
1421
/// <param name = "filter">The options used to control which commits will be returned.</param>
15-
/// <returns>A collection of commits, ready to be enumerated.</returns>
16-
ICommitCollection QueryBy(Filter filter);
22+
/// <returns>A list of commits, ready to be enumerated.</returns>
23+
ICommitLog QueryBy(Filter filter);
1724

1825
/// <summary>
1926
/// Stores the content of the <see cref = "Repository.Index" /> as a new <see cref = "Commit" /> into the repository.

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<Compile Include="BranchCollection.cs" />
6262
<Compile Include="Changes.cs" />
6363
<Compile Include="Commit.cs" />
64-
<Compile Include="CommitCollection.cs" />
64+
<Compile Include="CommitLog.cs" />
6565
<Compile Include="Configuration.cs" />
6666
<Compile Include="ContentChanges.cs" />
6767
<Compile Include="Core\Compat\Environment.cs" />
@@ -130,12 +130,12 @@
130130
<Compile Include="GitSortOptions.cs" />
131131
<Compile Include="Core\LambdaEqualityHelper.cs" />
132132
<Compile Include="Core\Libgit2UnsafeHelper.cs" />
133-
<Compile Include="ICommitCollection.cs" />
133+
<Compile Include="ICommitLog.cs" />
134134
<Compile Include="Index.cs" />
135135
<Compile Include="IndexEntry.cs" />
136136
<Compile Include="Core\Handles\IndexSafeHandle.cs" />
137137
<Compile Include="Filter.cs" />
138-
<Compile Include="IQueryableCommitCollection.cs" />
138+
<Compile Include="IQueryableCommitLog.cs" />
139139
<Compile Include="Core\LookUpOptions.cs" />
140140
<Compile Include="Mode.cs" />
141141
<Compile Include="ObjectDatabase.cs" />

LibGit2Sharp/Repository.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LibGit2Sharp
1616
public class Repository : IDisposable
1717
{
1818
private readonly BranchCollection branches;
19-
private readonly CommitCollection commits;
19+
private readonly CommitLog commits;
2020
private readonly Lazy<Configuration> config;
2121
private readonly RepositorySafeHandle handle;
2222
private readonly Index index;
@@ -86,7 +86,7 @@ public Repository(string path, RepositoryOptions options = null)
8686
index = indexBuilder();
8787
}
8888

89-
commits = new CommitCollection(this);
89+
commits = new CommitLog(this);
9090
refs = new ReferenceCollection(this);
9191
branches = new BranchCollection(this);
9292
tags = new TagCollection(this);
@@ -185,7 +185,7 @@ public RemoteCollection Remotes
185185
/// Lookup and enumerate commits in the repository.
186186
/// Iterating this collection directly starts walking from the HEAD.
187187
/// </summary>
188-
public IQueryableCommitCollection Commits
188+
public IQueryableCommitLog Commits
189189
{
190190
get { return commits; }
191191
}

0 commit comments

Comments
 (0)
0