diff options
author | Robin Stocker <robin@nibor.org> | 2011-04-03 19:37:55 +0200 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-04-06 13:28:10 -0500 |
commit | 6e10aa42e90a25b82f00f0c27574f57ffa9e4a25 (patch) | |
tree | e2bf294858e9a16220df5ab54508d94267c14109 /org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java | |
parent | fbf35fea4ec254339f9b0eee7865eb6ccfe22700 (diff) | |
download | jgit-6e10aa42e90a25b82f00f0c27574f57ffa9e4a25.tar.gz jgit-6e10aa42e90a25b82f00f0c27574f57ffa9e4a25.zip |
Add CHERRY_PICK_HEAD for cherry-pick conflicts
Add handling of CHERRY_PICK_HEAD file in .git (similar to MERGE_HEAD),
which is written in case of a conflicting cherry-pick merge.
It is used so that Repository.getRepositoryState can return the new
states CHERRY_PICKING and CHERRY_PICKING_RESOLVED. These states, as well
as CHERRY_PICK_HEAD can be used in EGit to properly show the merge tool.
Also, in case of a conflict, MERGE_MSG is written with the original
commit message and a "Conflicts" section appended. This way, the
cherry-picked message is not lost and can later be re-used in the commit
dialog.
Bug: 339092
Change-Id: I947967fdc2f1d55016c95106b104c2afcc9797a1
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java index cdd7a2f371..96395d0bfa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java @@ -123,6 +123,27 @@ public class MergeMessageFormatter { return sb.toString(); } + /** + * Add section with conflicting paths to merge message. + * + * @param message + * the original merge message + * @param conflictingPaths + * the paths with conflicts + * @return merge message with conflicting paths added + */ + public String formatWithConflicts(String message, + List<String> conflictingPaths) { + StringBuilder sb = new StringBuilder(message); + if (!message.endsWith("\n")) + sb.append("\n"); + sb.append("\n"); + sb.append("Conflicts:\n"); + for (String conflictingPath : conflictingPaths) + sb.append('\t').append(conflictingPath).append('\n'); + return sb.toString(); + } + private static String joinNames(List<String> names, String singular, String plural) { if (names.size() == 1) |