diff options
author | Tomasz Zarna <tomasz.zarna@tasktop.com> | 2012-01-12 18:32:53 +0100 |
---|---|---|
committer | Tomasz Zarna <tomasz.zarna@tasktop.com> | 2013-04-04 15:11:49 +0200 |
commit | 545358577376bec8fc140a76ce0f72bf81cc0a94 (patch) | |
tree | 410629280cc5f6a62a09334b0a28937214539928 /org.eclipse.jgit.pgm | |
parent | 81b601de53125bbcd30620b58168154d7541d8ad (diff) | |
download | jgit-545358577376bec8fc140a76ce0f72bf81cc0a94.tar.gz jgit-545358577376bec8fc140a76ce0f72bf81cc0a94.zip |
Add the no-commit option to MergeCommand
Added also tests and the associated option for the command line Merge
command.
Bug: 335091
Change-Id: Ie321c572284a6f64765a81674089fc408a10d059
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
4 files changed, 16 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/.settings/.api_filters b/org.eclipse.jgit.pgm/.settings/.api_filters index 5e044ee2ad..35db29c922 100644 --- a/org.eclipse.jgit.pgm/.settings/.api_filters +++ b/org.eclipse.jgit.pgm/.settings/.api_filters @@ -3,6 +3,11 @@ <resource path="src/org/eclipse/jgit/pgm/CLIText.java" type="org.eclipse.jgit.pgm.CLIText"> <filter id="1143996420"> <message_arguments> + <message_argument value="mergeWentWellStoppedBeforeCommitting"/> + </message_arguments> + </filter> + <filter id="1143996420"> + <message_arguments> <message_argument value="noSuchRemoteRef"/> </message_arguments> </filter> diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties index d9684054c1..eed05e89f5 100644 --- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties +++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties @@ -68,6 +68,7 @@ mergeConflict=CONFLICT(content): Merge conflict in {0} mergeFailed=Automatic merge failed; fix conflicts and then commit the result mergeMadeBy=Merge made by the ''{0}'' strategy. mergedSquashed=Squash commit -- not updating HEAD\nAutomatic merge went well; stopped before committing as requested +mergeWentWellStoppedBeforeCommitting=Automatic merge went well; stopped before committing as requested metaVar_DAG=DAG metaVar_KEY=KEY metaVar_archiveFormat=format @@ -248,6 +249,7 @@ usage_manageReflogInformation=Manage reflog information usage_mergeStrategy=Use the given merge strategy. Can be supplied more than once to specify them in the order they should be tried. If there is no -s option, the resolve strategy is used. Currently the following strategies are supported: ours, theirs, simple-two-way-in-core, resolve usage_moveRenameABranch=move/rename a branch usage_nameStatus=show only name and status of files +usage_noCommit=Don't commit after a successful merge usage_noPrefix=do not show any source or destination prefix usage_noRenames=disable rename detection usage_noShowStandardNotes=Disable showing notes from the standard /refs/notes/commits branch diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java index 807fe39db9..64bd18e867 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java @@ -137,6 +137,7 @@ public class CLIText extends TranslationBundle { /***/ public String mergeFailed; /***/ public String mergeMadeBy; /***/ public String mergedSquashed; + /***/ public String mergeWentWellStoppedBeforeCommitting; /***/ public String metaVar_KEY; /***/ public String metaVar_archiveFormat; /***/ public String metaVar_arg; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java index 7eaa5fa351..97198259d3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java @@ -71,6 +71,9 @@ class Merge extends TextBuiltin { @Option(name = "--squash", usage = "usage_squash") private boolean squash; + @Option(name = "--no-commit", usage = "usage_noCommit") + private boolean noCommit = false; + private MergeStrategy mergeStrategy = MergeStrategy.RESOLVE; @Argument(required = true) @@ -111,7 +114,7 @@ class Merge extends TextBuiltin { Ref oldHead = db.getRef(Constants.HEAD); Git git = new Git(db); MergeCommand mergeCmd = git.merge().setStrategy(mergeStrategy) - .setSquash(squash).setFastForward(ff); + .setSquash(squash).setFastForward(ff).setCommit(!noCommit); if (srcRef != null) mergeCmd.include(srcRef); else @@ -160,8 +163,12 @@ class Merge extends TextBuiltin { name = "recursive"; //$NON-NLS-1$ outw.println(MessageFormat.format(CLIText.get().mergeMadeBy, name)); break; + case MERGED_NOT_COMMITTED: + outw.println(CLIText.get().mergeWentWellStoppedBeforeCommitting); + break; case MERGED_SQUASHED: case FAST_FORWARD_SQUASHED: + case MERGED_SQUASHED_NOT_COMMITTED: outw.println(CLIText.get().mergedSquashed); break; case ABORTED: |