Browse Source

Merge changes I8c06635c,I62d6de7d

* changes:
  Silence non-externalized string warning in CherryPickCommand
  Use try-with-resource to close resources in CherryPickCommand
stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
297600f7c2
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

7
org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java

@ -123,8 +123,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
List<Ref> cherryPickedRefs = new LinkedList<Ref>();
checkCallable();
RevWalk revWalk = new RevWalk(repo);
try {
try (RevWalk revWalk = new RevWalk(repo)) {
// get the head commit
Ref headRef = repo.getRef(Constants.HEAD);
@ -153,7 +152,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
ResolveMerger merger = (ResolveMerger) strategy.newMerger(repo);
merger.setWorkingTreeIterator(new FileTreeIterator(repo));
merger.setBase(srcParent.getTree());
merger.setCommitNames(new String[] { "BASE", ourName,
merger.setCommitNames(new String[] { "BASE", ourName, //$NON-NLS-1$
cherryPickName });
if (merger.merge(newHead, srcCommit)) {
if (AnyObjectId.equals(newHead.getTree().getId(), merger
@ -194,8 +193,6 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
MessageFormat.format(
JGitText.get().exceptionCaughtDuringExecutionOfCherryPickCommand,
e), e);
} finally {
revWalk.release();
}
return new CherryPickResult(newHead, cherryPickedRefs);
}

Loading…
Cancel
Save