Skip to content

Commit 098b62a

Browse files
author
Jeremy Koritzinsky
committed
Made changes requested in code review on github.
1 parent 333646e commit 098b62a

File tree

6 files changed

+33
-30
lines changed

6 files changed

+33
-30
lines changed

LibGit2Sharp.Tests/CherryPickFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void CanCherryPickCommit()
138138

139139
var result = repo.ObjectDatabase.CherryPickCommit(commitToMerge, ours, 0, null);
140140

141-
Assert.Equal(CherryPickStatus.CherryPicked, result.Status);
141+
Assert.Equal(MergeTreeStatus.Succeeded, result.Status);
142142
Assert.Equal(0, result.Conflicts.Count());
143143
}
144144
}
@@ -156,9 +156,9 @@ public void CherryPickWithConflictsReturnsConflicts()
156156

157157
var result = repo.ObjectDatabase.CherryPickCommit(branch.Tip, repo.Head.Tip, 0, null);
158158

159-
Assert.Equal(CherryPickStatus.Conflicts, result.Status);
159+
Assert.Equal(MergeTreeStatus.Conflicts, result.Status);
160160
Assert.NotEmpty(result.Conflicts);
161-
161+
162162
}
163163
}
164164

LibGit2Sharp.Tests/RevertFixture.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,14 @@ public void RevertWithConflictReportsConflict()
512512
[Fact]
513513
public void CanRevertInObjectDatabase()
514514
{
515-
// The branch name to perform the revert on,
516-
// and the file whose contents we expect to be reverted.
515+
// The branch name to perform the revert on
517516
const string revertBranchName = "refs/heads/revert";
518517

519518
string path = SandboxRevertTestRepo();
520519
using (var repo = new Repository(path))
521520
{
522521

523-
522+
524523
// Checkout the revert branch.
525524
Branch branch = Commands.Checkout(repo, revertBranchName);
526525
Assert.NotNull(branch);

LibGit2Sharp/CherryPickTreeResult.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace LibGit2Sharp
77
{
88
/// <summary>
9-
/// Class to report the result of a cherry picked.
9+
/// Class to report the result of a cherry pick.
1010
/// </summary>
1111
public class CherryPickTreeResult
1212
{
@@ -19,14 +19,14 @@ protected CherryPickTreeResult()
1919
internal CherryPickTreeResult(Tree tree)
2020
{
2121
this.Tree = tree;
22-
this.Status = CherryPickStatus.CherryPicked;
22+
this.Status = MergeTreeStatus.Succeeded;
2323
this.Conflicts = new List<Conflict>();
2424
}
2525

2626
internal CherryPickTreeResult(IEnumerable<Conflict> conflicts)
2727
{
2828
this.Conflicts = conflicts;
29-
this.Status = CherryPickStatus.Conflicts;
29+
this.Status = MergeTreeStatus.Conflicts;
3030
}
3131

3232
/// <summary>
@@ -43,6 +43,7 @@ internal CherryPickTreeResult(IEnumerable<Conflict> conflicts)
4343
/// <summary>
4444
/// The status of the cherry pick.
4545
/// </summary>
46-
public virtual CherryPickStatus Status { get; private set; }
46+
public virtual MergeTreeStatus Status { get; private set; }
4747
}
4848
}
49+

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,4 +395,4 @@
395395
</Target>
396396
-->
397397
<ItemGroup />
398-
</Project>
398+
</Project>

LibGit2Sharp/ObjectDatabase.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -542,17 +542,17 @@ public virtual HistoryDivergence CalculateHistoryDivergence(Commit one, Commit a
542542
}
543543

544544
/// <summary>
545-
/// Performs a cherry-pick of <paramref name="cherryPickCommit"/> onto <paramref name="ours"/> commit.
545+
/// Performs a cherry-pick of <paramref name="cherryPickCommit"/> onto <paramref name="cherryPickOnto"/> commit.
546546
/// </summary>
547547
/// <param name="cherryPickCommit">The commit to cherry-pick.</param>
548-
/// <param name="ours">The commit to cherry-pick onto.</param>
548+
/// <param name="cherryPickOnto">The commit to cherry-pick onto.</param>
549549
/// <param name="mainline">Which commit to consider the parent for the diff when cherry-picking a merge commit.</param>
550550
/// <param name="options">The options for the merging in the cherry-pick operation.</param>
551551
/// <returns>A result containing a <see cref="Tree"/> if the cherry-pick was successful and a list of <see cref="Conflict"/>s if it is not.</returns>
552-
public virtual CherryPickTreeResult CherryPickCommit(Commit cherryPickCommit, Commit ours, int mainline, MergeOptions options)
552+
public virtual CherryPickTreeResult CherryPickCommit(Commit cherryPickCommit, Commit cherryPickOnto, int mainline, MergeOptions options)
553553
{
554554
Ensure.ArgumentNotNull(cherryPickCommit, "cherryPickCommit");
555-
Ensure.ArgumentNotNull(ours, "ours");
555+
Ensure.ArgumentNotNull(cherryPickOnto, "ours");
556556

557557
options = options ?? new MergeOptions();
558558

@@ -579,10 +579,10 @@ public virtual CherryPickTreeResult CherryPickCommit(Commit cherryPickCommit, Co
579579
};
580580

581581
bool earlyStop;
582-
583-
using (var ourHandle = Proxy.git_object_lookup(repo.Handle, ours.Id, GitObjectType.Commit))
582+
583+
using (var cherryPickOntoHandle = Proxy.git_object_lookup(repo.Handle, cherryPickOnto.Id, GitObjectType.Commit))
584584
using (var cherryPickCommitHandle = Proxy.git_object_lookup(repo.Handle, cherryPickCommit.Id, GitObjectType.Commit))
585-
using (var indexHandle = Proxy.git_cherrypick_commit(repo.Handle, cherryPickCommitHandle, ourHandle, (uint)mainline, opts, out earlyStop))
585+
using (var indexHandle = Proxy.git_cherrypick_commit(repo.Handle, cherryPickCommitHandle, cherryPickOntoHandle, (uint)mainline, opts, out earlyStop))
586586
{
587587
CherryPickTreeResult cherryPickResult;
588588

@@ -882,17 +882,17 @@ private PackBuilderResults InternalPack(PackBuilderOptions options, Action<PackB
882882
}
883883

884884
/// <summary>
885-
/// Performs a revert of <paramref name="revertCommit"/> onto <paramref name="ours"/> commit.
885+
/// Performs a revert of <paramref name="revertCommit"/> onto <paramref name="revertOnto"/> commit.
886886
/// </summary>
887887
/// <param name="revertCommit">The commit to revert.</param>
888-
/// <param name="ours">The commit to revert onto.</param>
888+
/// <param name="revertOnto">The commit to revert onto.</param>
889889
/// <param name="mainline">Which commit to consider the parent for the diff when reverting a merge commit.</param>
890890
/// <param name="options">The options for the merging in the revert operation.</param>
891891
/// <returns>A result containing a <see cref="Tree"/> if the revert was successful and a list of <see cref="Conflict"/>s if it is not.</returns>
892-
public virtual RevertTreeResult RevertCommit(Commit revertCommit, Commit ours, int mainline, MergeOptions options)
892+
public virtual RevertTreeResult RevertCommit(Commit revertCommit, Commit revertOnto, int mainline, MergeOptions options)
893893
{
894894
Ensure.ArgumentNotNull(revertCommit, "revertCommit");
895-
Ensure.ArgumentNotNull(ours, "ours");
895+
Ensure.ArgumentNotNull(revertOnto, "ours");
896896

897897
options = options ?? new MergeOptions();
898898

@@ -920,9 +920,9 @@ public virtual RevertTreeResult RevertCommit(Commit revertCommit, Commit ours, i
920920

921921
bool earlyStop;
922922

923-
using (var ourHandle = Proxy.git_object_lookup(repo.Handle, ours.Id, GitObjectType.Commit))
924-
using (var cherryPickCommitHandle = Proxy.git_object_lookup(repo.Handle, revertCommit.Id, GitObjectType.Commit))
925-
using (var indexHandle = Proxy.git_revert_commit(repo.Handle, cherryPickCommitHandle, ourHandle, (uint)mainline, opts, out earlyStop))
923+
using (var revertOntoHandle = Proxy.git_object_lookup(repo.Handle, revertOnto.Id, GitObjectType.Commit))
924+
using (var revertCommitHandle = Proxy.git_object_lookup(repo.Handle, revertCommit.Id, GitObjectType.Commit))
925+
using (var indexHandle = Proxy.git_revert_commit(repo.Handle, revertCommitHandle, revertOntoHandle, (uint)mainline, opts, out earlyStop))
926926
{
927927
RevertTreeResult revertTreeResult;
928928

LibGit2Sharp/RevertTreeResult.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace LibGit2Sharp
44
{
5+
/// <summary>
6+
/// The result of a revert of one tree onto another tree.
7+
/// </summary>
58
public class RevertTreeResult
69
{
710
/// <summary>
@@ -24,19 +27,19 @@ internal RevertTreeResult(IEnumerable<Conflict> conflicts)
2427
}
2528

2629
/// <summary>
27-
/// The resulting tree of the cherry-pick.
28-
/// <para>This will return <code>null</code> if the cherry-pick has been unsuccessful due to conflicts.</para>
30+
/// The resulting tree of the revert.
31+
/// <para>This will return <code>null</code> if the revert has been unsuccessful due to conflicts.</para>
2932
/// </summary>
3033
public virtual Tree Tree { get; private set; }
3134

3235
/// <summary>
33-
/// The resulting conflicts from the cherry-pick.
36+
/// The resulting conflicts from the revert.
3437
/// </summary>
3538
public virtual IEnumerable<Conflict> Conflicts { get; private set; }
3639

3740
/// <summary>
38-
/// The status of the cherry pick.
41+
/// The status of the revert.
3942
/// </summary>
4043
public virtual MergeTreeStatus Status { get; private set; }
4144
}
42-
}
45+
}

0 commit comments

Comments
 (0)