Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Add Cherry-pick and Revert functionality to ObjectDatabase #1323
Conversation
/// </summary> | ||
public virtual MergeTreeStatus Status { get; private set; } | ||
} | ||
} |
} | ||
|
||
/// <summary> | ||
/// The resulting tree of the cherry-pick. |
jamill
Jun 1, 2016
Member
I think these comments have some left over text from the cherry-pick version :) Would you mind just updating them to refer to the revert action?
bool earlyStop; | ||
|
||
using (var ourHandle = Proxy.git_object_lookup(repo.Handle, ours.Id, GitObjectType.Commit)) | ||
using (var cherryPickCommitHandle = Proxy.git_object_lookup(repo.Handle, revertCommit.Id, GitObjectType.Commit)) |
/// <param name="mainline">Which commit to consider the parent for the diff when cherry-picking a merge commit.</param> | ||
/// <param name="options">The options for the merging in the cherry-pick operation.</param> | ||
/// <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> | ||
public virtual CherryPickTreeResult CherryPickCommit(Commit cherryPickCommit, Commit ours, int mainline, MergeOptions options) |
jamill
Jun 1, 2016
Member
Does ours
work for cherry-pick? What would you think of cherryPickOnto
instead of ours
?
@@ -393,4 +395,4 @@ | |||
</Target> | |||
--> | |||
<ItemGroup /> | |||
</Project> | |||
</Project> |
jamill
Jun 1, 2016
Member
A bit harder for generated files - but instead of fighting about the trailing newline, could you go back and add it here?
public void CanRevertInObjectDatabase() | ||
{ | ||
// The branch name to perform the revert on, | ||
// and the file whose contents we expect to be reverted. |
|
||
|
||
// Checkout the revert branch. | ||
Branch branch = Commands.Checkout(repo, revertBranchName); |
jkoritzinsky
Jun 1, 2016
Author
We need to either checkout and do the revert on the checked out branch or generate a commit from the resulting tree after the first revert and apply that before the second revert. The code is much cleaner to check out the branch to perform the first revert on.
I think it would be better if both |
Thank you @jkoritzinsky for this very nice PR! |
This looks really good to me. One question: do we need separate |
We can use a single class, but I am having trouble coming up with a good name. Do you have any suggestions? |
I, personally, would be okay with using |
|
I also like |
Great! Can you squash this and I'll merge it? Thanks! |
… object database. Added support for revert in a bare repository. Updated CanRevertInObjectDatabase to not use a checkout and to just use commit refs. Changed methods to use `MergeTreeResult` and fixed incorrect name in argument validation.
9e324d7
to
d59c673
Squashed! |
This PR adds support for cherry-picking and reverting commits using the
*_commit
functions from libgit2 to allow cherry picking and reverting on a bare repository.