aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorOliver Lockwood <oliver.lockwood@cantab.net>2017-06-21 17:34:05 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2017-06-22 09:08:55 +0200
commit43672700e747c3f95b64871b125129c152b9fa20 (patch)
tree1a02fb37904a5cd317ba2231f75548077d485c12 /org.eclipse.jgit.pgm
parent060f3699d473a977b86b2ad9d653df4c83e8b681 (diff)
downloadjgit-43672700e747c3f95b64871b125129c152b9fa20.tar.gz
jgit-43672700e747c3f95b64871b125129c152b9fa20.zip
Add --match option for `jgit describe` to CLI
This adds --match option for glob(7) matchers on git tags to jgit describe in CLI. Bug: 518377 Change-Id: I745988d565dd4391e8b3e5a91bbfbae575333819 Signed-off-by: Oliver Lockwood <oliver.lockwood@cantab.net>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties2
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java7
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java1
3 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index c3d7c685ff..8666c34296 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -129,6 +129,7 @@ metaVar_op=OP
metaVar_pass=PASS
metaVar_path=path
metaVar_paths=path ...
+metaVar_pattern=pattern
metaVar_port=PORT
metaVar_ref=REF
metaVar_refs=REFS
@@ -248,6 +249,7 @@ usage_lsRemoteHeads=Show only refs starting with refs/heads
usage_lsRemoteTags=Show only refs starting with refs/tags
usage_LsTree=List the contents of a tree object
usage_MakeCacheTree=Show the current cache tree structure
+usage_Match=Only consider tags matching the given glob(7) pattern or patterns, excluding the "refs/tags/" prefix.
usage_MergeBase=Find as good common ancestors as possible for a merge
usage_MergesTwoDevelopmentHistories=Merges two development histories
usage_PreserveOldPacks=Preserve old pack files by moving them into the preserved subdirectory instead of deleting them after repacking
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
index ec000f388b..eba5a43be1 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Describe.java
@@ -50,6 +50,9 @@ import org.eclipse.jgit.pgm.internal.CLIText;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
+import java.util.ArrayList;
+import java.util.List;
+
@Command(common = true, usage = "usage_Describe")
class Describe extends TextBuiltin {
@@ -59,6 +62,9 @@ class Describe extends TextBuiltin {
@Option(name = "--long", usage = "usage_LongFormat")
private boolean longDesc;
+ @Option(name = "--match", multiValued = true, usage = "usage_Match", metaVar = "metaVar_pattern")
+ private List<String> patterns = new ArrayList<>();
+
@Override
protected void run() throws Exception {
try (Git git = new Git(db)) {
@@ -66,6 +72,7 @@ class Describe extends TextBuiltin {
if (tree != null)
cmd.setTarget(tree);
cmd.setLong(longDesc);
+ cmd.setMatch(patterns.toArray(new String[patterns.size()]));
String result = null;
try {
result = cmd.call();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java
index e012372b92..1424dab05b 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java
@@ -196,6 +196,7 @@ public class CLIText extends TranslationBundle {
/***/ public String metaVar_pass;
/***/ public String metaVar_path;
/***/ public String metaVar_paths;
+ /***/ public String metaVar_pattern;
/***/ public String metaVar_port;
/***/ public String metaVar_ref;
/***/ public String metaVar_refs;