Browse Source

Add --all switch to org.eclipse.jgit.pgm.Commit

Change-Id: Iab52f995676daf60e0dfa043cc9e022f6e32a758
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
stable-2.0
Tomasz Zarna 13 years ago committed by Chris Aniszczyk
parent
commit
94285e691a
  1. 2
      org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties
  2. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
  3. 8
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java

2
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties

@ -123,6 +123,7 @@ notAnObject={0} is not an object
notFound=!! NOT FOUND !! notFound=!! NOT FOUND !!
noteObjectTooLargeToPrint=Note object {0} too large to print noteObjectTooLargeToPrint=Note object {0} too large to print
onlyOneMetaVarExpectedIn=Only one {0} expected in {1}. onlyOneMetaVarExpectedIn=Only one {0} expected in {1}.
onlyOneOfIncludeOnlyAllInteractiveCanBeUsed=Only one of --include/--only/--all/--interactive can be used.
pushTo=To {0} pushTo=To {0}
pathsRequired=at least one path has to be specified when using --only pathsRequired=at least one path has to be specified when using --only
refDoesNotExistOrNoCommit={0} does not exist or is not referring to a commit refDoesNotExistOrNoCommit={0} does not exist or is not referring to a commit
@ -138,6 +139,7 @@ unknownMergeStratey=unknown merge strategy {0} specified
unsupportedOperation=Unsupported operation: {0} unsupportedOperation=Unsupported operation: {0}
usage_Blame=Show what revision and author last modified each line usage_Blame=Show what revision and author last modified each line
usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service
usage_CommitAll=commit all modified and deleted files
usage_CommitAuthor=Override the author name used in the commit. You can use the standard A U Thor <author@example.com> format. usage_CommitAuthor=Override the author name used in the commit. You can use the standard A U Thor <author@example.com> format.
usage_CommitMessage=Use the given <msg> as the commit message usage_CommitMessage=Use the given <msg> as the commit message
usage_CommitOnly=commit specified paths only usage_CommitOnly=commit specified paths only

3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com> * Copyright (C) 2010, 2012 Sasa Zivkov <sasa.zivkov@sap.com>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available * This program and the accompanying materials are made available
@ -170,6 +170,7 @@ public class CLIText extends TranslationBundle {
/***/ public String notFound; /***/ public String notFound;
/***/ public String noteObjectTooLargeToPrint; /***/ public String noteObjectTooLargeToPrint;
/***/ public String onlyOneMetaVarExpectedIn; /***/ public String onlyOneMetaVarExpectedIn;
/***/ public String onlyOneOfIncludeOnlyAllInteractiveCanBeUsed;
/***/ public String pushTo; /***/ public String pushTo;
/***/ public String pathsRequired; /***/ public String pathsRequired;
/***/ public String refDoesNotExistOrNoCommit; /***/ public String refDoesNotExistOrNoCommit;

8
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2010, Christian Halstrick <christian.halstrick@sap.com> and * Copyright (C) 2010, 2012 Christian Halstrick <christian.halstrick@sap.com> and
* other copyright owners as documented in the project's IP log. * other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available under the * This program and the accompanying materials are made available under the
@ -67,6 +67,9 @@ class Commit extends TextBuiltin {
@Option(name = "--only", aliases = { "-o" }, usage = "usage_CommitOnly") @Option(name = "--only", aliases = { "-o" }, usage = "usage_CommitOnly")
private boolean only; private boolean only;
@Option(name = "--all", aliases = { "-a" }, usage = "usage_CommitAll")
private boolean all;
@Option(name = "--amend", usage = "usage_CommitAmend") @Option(name = "--amend", usage = "usage_CommitAmend")
private boolean amend; private boolean amend;
@ -83,10 +86,13 @@ class Commit extends TextBuiltin {
commitCmd.setMessage(message); commitCmd.setMessage(message);
if (only && paths.isEmpty()) if (only && paths.isEmpty())
throw die(CLIText.get().pathsRequired); throw die(CLIText.get().pathsRequired);
if (only && all)
throw die(CLIText.get().onlyOneOfIncludeOnlyAllInteractiveCanBeUsed);
if (!paths.isEmpty()) if (!paths.isEmpty())
for (String p : paths) for (String p : paths)
commitCmd.setOnly(p); commitCmd.setOnly(p);
commitCmd.setAmend(amend); commitCmd.setAmend(amend);
commitCmd.setAll(all);
Ref head = db.getRef(Constants.HEAD); Ref head = db.getRef(Constants.HEAD);
RevCommit commit = commitCmd.call(); RevCommit commit = commitCmd.call();

Loading…
Cancel
Save