diff options
Diffstat (limited to 'org.eclipse.jgit.pgm')
10 files changed, 153 insertions, 59 deletions
diff --git a/org.eclipse.jgit.pgm/BUILD b/org.eclipse.jgit.pgm/BUILD index 2593122f40..a267b155ac 100644 --- a/org.eclipse.jgit.pgm/BUILD +++ b/org.eclipse.jgit.pgm/BUILD @@ -8,6 +8,7 @@ java_library( visibility = ["//visibility:public"], runtime_deps = [ ":services", + "//lib:javaewah", "//org.eclipse.jgit.gpg.bc:gpg-bc", ], deps = [ diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF index 39ea131291..ecbb24cd13 100644 --- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Automatic-Module-Name: org.eclipse.jgit.pgm Bundle-SymbolicName: org.eclipse.jgit.pgm -Bundle-Version: 6.3.1.qualifier +Bundle-Version: 6.4.1.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 @@ -14,49 +14,49 @@ Import-Package: javax.servlet;version="[3.1.0,5.0.0)", org.eclipse.jetty.servlet;version="[10.0.0,11.0.0)", org.eclipse.jetty.util;version="[10.0.0,11.0.0)", org.eclipse.jetty.util.component;version="[10.0.0,11.0.0)", - org.eclipse.jgit.api;version="[6.3.1,6.4.0)", - org.eclipse.jgit.api.errors;version="[6.3.1,6.4.0)", - org.eclipse.jgit.archive;version="[6.3.1,6.4.0)", - org.eclipse.jgit.awtui;version="[6.3.1,6.4.0)", - org.eclipse.jgit.blame;version="[6.3.1,6.4.0)", - org.eclipse.jgit.diff;version="[6.3.1,6.4.0)", - org.eclipse.jgit.dircache;version="[6.3.1,6.4.0)", - org.eclipse.jgit.errors;version="[6.3.1,6.4.0)", - org.eclipse.jgit.gitrepo;version="[6.3.1,6.4.0)", - org.eclipse.jgit.internal.storage.file;version="[6.3.1,6.4.0)", - org.eclipse.jgit.internal.diffmergetool;version="[6.3.1,6.4.0)", - org.eclipse.jgit.internal.storage.io;version="[6.3.1,6.4.0)", - org.eclipse.jgit.internal.storage.pack;version="[6.3.1,6.4.0)", - org.eclipse.jgit.internal.storage.reftable;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lfs;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lfs.server;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lfs.server.fs;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lfs.server.s3;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lib;version="[6.3.1,6.4.0)", - org.eclipse.jgit.merge;version="[6.3.1,6.4.0)", - org.eclipse.jgit.lib.internal;version="[6.3.1,6.4.0)", - org.eclipse.jgit.nls;version="[6.3.1,6.4.0)", - org.eclipse.jgit.notes;version="[6.3.1,6.4.0)", - org.eclipse.jgit.revplot;version="[6.3.1,6.4.0)", - org.eclipse.jgit.revwalk;version="[6.3.1,6.4.0)", - org.eclipse.jgit.revwalk.filter;version="[6.3.1,6.4.0)", - org.eclipse.jgit.storage.file;version="[6.3.1,6.4.0)", - org.eclipse.jgit.storage.pack;version="[6.3.1,6.4.0)", - org.eclipse.jgit.transport;version="[6.3.1,6.4.0)", - org.eclipse.jgit.transport.http.apache;version="[6.3.1,6.4.0)", - org.eclipse.jgit.transport.resolver;version="[6.3.1,6.4.0)", - org.eclipse.jgit.transport.ssh.jsch;version="[6.3.1,6.4.0)", - org.eclipse.jgit.transport.sshd;version="[6.3.1,6.4.0)", - org.eclipse.jgit.treewalk;version="[6.3.1,6.4.0)", - org.eclipse.jgit.treewalk.filter;version="[6.3.1,6.4.0)", - org.eclipse.jgit.util;version="[6.3.1,6.4.0)", - org.eclipse.jgit.util.io;version="[6.3.1,6.4.0)", + org.eclipse.jgit.api;version="[6.4.1,6.5.0)", + org.eclipse.jgit.api.errors;version="[6.4.1,6.5.0)", + org.eclipse.jgit.archive;version="[6.4.1,6.5.0)", + org.eclipse.jgit.awtui;version="[6.4.1,6.5.0)", + org.eclipse.jgit.blame;version="[6.4.1,6.5.0)", + org.eclipse.jgit.diff;version="[6.4.1,6.5.0)", + org.eclipse.jgit.dircache;version="[6.4.1,6.5.0)", + org.eclipse.jgit.errors;version="[6.4.1,6.5.0)", + org.eclipse.jgit.gitrepo;version="[6.4.1,6.5.0)", + org.eclipse.jgit.internal.storage.file;version="[6.4.1,6.5.0)", + org.eclipse.jgit.internal.diffmergetool;version="[6.4.1,6.5.0)", + org.eclipse.jgit.internal.storage.io;version="[6.4.1,6.5.0)", + org.eclipse.jgit.internal.storage.pack;version="[6.4.1,6.5.0)", + org.eclipse.jgit.internal.storage.reftable;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lfs;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lfs.server;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lfs.server.fs;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lfs.server.s3;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lib;version="[6.4.1,6.5.0)", + org.eclipse.jgit.merge;version="[6.4.1,6.5.0)", + org.eclipse.jgit.lib.internal;version="[6.4.1,6.5.0)", + org.eclipse.jgit.nls;version="[6.4.1,6.5.0)", + org.eclipse.jgit.notes;version="[6.4.1,6.5.0)", + org.eclipse.jgit.revplot;version="[6.4.1,6.5.0)", + org.eclipse.jgit.revwalk;version="[6.4.1,6.5.0)", + org.eclipse.jgit.revwalk.filter;version="[6.4.1,6.5.0)", + org.eclipse.jgit.storage.file;version="[6.4.1,6.5.0)", + org.eclipse.jgit.storage.pack;version="[6.4.1,6.5.0)", + org.eclipse.jgit.transport;version="[6.4.1,6.5.0)", + org.eclipse.jgit.transport.http.apache;version="[6.4.1,6.5.0)", + org.eclipse.jgit.transport.resolver;version="[6.4.1,6.5.0)", + org.eclipse.jgit.transport.ssh.jsch;version="[6.4.1,6.5.0)", + org.eclipse.jgit.transport.sshd;version="[6.4.1,6.5.0)", + org.eclipse.jgit.treewalk;version="[6.4.1,6.5.0)", + org.eclipse.jgit.treewalk.filter;version="[6.4.1,6.5.0)", + org.eclipse.jgit.util;version="[6.4.1,6.5.0)", + org.eclipse.jgit.util.io;version="[6.4.1,6.5.0)", org.kohsuke.args4j;version="[2.33.0,3.0.0)", org.kohsuke.args4j.spi;version="[2.33.0,3.0.0)" -Export-Package: org.eclipse.jgit.console;version="6.3.1"; +Export-Package: org.eclipse.jgit.console;version="6.4.1"; uses:="org.eclipse.jgit.transport, org.eclipse.jgit.util", - org.eclipse.jgit.pgm;version="6.3.1"; + org.eclipse.jgit.pgm;version="6.4.1"; uses:="org.eclipse.jgit.transport, org.eclipse.jgit.util.io, org.eclipse.jgit.awtui, @@ -68,14 +68,14 @@ Export-Package: org.eclipse.jgit.console;version="6.3.1"; org.eclipse.jgit.treewalk, org.eclipse.jgit.api, javax.swing", - org.eclipse.jgit.pgm.debug;version="6.3.1"; + org.eclipse.jgit.pgm.debug;version="6.4.1"; uses:="org.eclipse.jgit.util.io, org.eclipse.jgit.pgm, org.eclipse.jetty.servlet", - org.eclipse.jgit.pgm.internal;version="6.3.1"; + org.eclipse.jgit.pgm.internal;version="6.4.1"; x-friends:="org.eclipse.jgit.pgm.test, org.eclipse.jgit.test", - org.eclipse.jgit.pgm.opt;version="6.3.1"; + org.eclipse.jgit.pgm.opt;version="6.4.1"; uses:="org.kohsuke.args4j, org.eclipse.jgit.lib, org.eclipse.jgit.revwalk, diff --git a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF index 4850be9008..e2bc4f09cf 100644 --- a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF +++ b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF @@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.eclipse.jgit.pgm - Sources Bundle-SymbolicName: org.eclipse.jgit.pgm.source Bundle-Vendor: Eclipse.org - JGit -Bundle-Version: 6.3.1.qualifier -Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="6.3.1.qualifier";roots="." +Bundle-Version: 6.4.1.qualifier +Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="6.4.1.qualifier";roots="." diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index 2a9f5d70f1..eda51f1ec3 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -17,7 +17,7 @@ <parent> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit-parent</artifactId> - <version>6.3.1-SNAPSHOT</version> + <version>6.4.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.jgit.pgm</artifactId> 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 74ea867ae6..e0db759985 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 @@ -40,6 +40,7 @@ cannotRenameDetachedHEAD=Cannot rename detached HEAD cannotResolve=Cannot resolve {0} cannotSetupConsole=Cannot setup console cannotUseObjectsWithGlog=Cannot use --objects with glog +cannotUseNameStatusOnlyAndNameOnly=Cannot use --name-only, --name-status are mutually exclusive cantFindGitDirectory=error: can't find git directory cantWrite=Can''t write {0} changesNotStagedForCommit=Changes not staged for commit: @@ -414,6 +415,7 @@ usage_mergeStrategy=Use the given merge strategy. Can be supplied more than once usage_message=Set the commit message to be used for the merge commit (in case one is created). usage_moveRenameABranch=move/rename a branch usage_nameStatus=show only name and status of files +usage_nameOnly=show only name of files usage_noCheckoutAfterClone=no checkout of HEAD is performed after the clone is complete usage_noCommit=Don't commit after a successful merge usage_noPrefix=do not show any source or destination prefix diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java index cdbcbc0d1b..3152c44554 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java @@ -48,6 +48,10 @@ import org.kohsuke.args4j.Option; class Diff extends TextBuiltin { private DiffFormatter diffFmt; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Argument(index = 0, metaVar = "metaVar_treeish") private AbstractTreeIterator oldTree; @@ -81,7 +85,22 @@ class Diff extends TextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -183,6 +202,9 @@ class Diff extends TextBuiltin { if (showNameAndStatusOnly) { nameStatus(outw, diffFmt.scan(oldTree, newTree)); outw.flush(); + } else if(showNameOnly) { + nameOnly(outw, diffFmt.scan(oldTree, newTree)); + outw.flush(); } else { diffFmt.format(oldTree, newTree); diffFmt.flush(); @@ -220,4 +242,27 @@ class Diff extends TextBuiltin { } } } + + static void nameOnly(ThrowingPrintWriter out, List<DiffEntry> files) + throws IOException { + for (DiffEntry ent : files) { + switch (ent.getChangeType()) { + case ADD: + out.println(ent.getNewPath()); + break; + case DELETE: + out.println(ent.getOldPath()); + break; + case MODIFY: + out.println(ent.getNewPath()); + break; + case COPY: + out.println(ent.getNewPath()); + break; + case RENAME: + out.println(ent.getNewPath()); + break; + } + } + } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 353b64b9be..d693051738 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -60,6 +60,10 @@ class Log extends RevWalkTextBuiltin { private Map<String, NoteMap> noteMaps; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Option(name="--decorate", usage="usage_showRefNamesMatchingCommits") private boolean decorate; @@ -99,7 +103,22 @@ class Log extends RevWalkTextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -266,8 +285,10 @@ class Log extends RevWalkTextBuiltin { if (showNotes(c)) outw.println(); - if (c.getParentCount() <= 1 && (showNameAndStatusOnly || showPatch)) + if (c.getParentCount() <= 1 && (showNameAndStatusOnly || showPatch + || showNameOnly)) { showDiff(c); + } outw.flush(); } @@ -364,9 +385,11 @@ class Log extends RevWalkTextBuiltin { : null; final RevTree b = c.getTree(); - if (showNameAndStatusOnly) + if (showNameAndStatusOnly) { Diff.nameStatus(outw, diffFmt.scan(a, b)); - else { + } else if (showNameOnly) { + Diff.nameOnly(outw, diffFmt.scan(a, b)); + } else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index 3beab60a8b..c18d35a205 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -58,6 +58,10 @@ class Show extends TextBuiltin { private DiffFormatter diffFmt; + private boolean showNameOnly = false; + + private boolean showNameAndStatusOnly = false; + @Argument(index = 0, metaVar = "metaVar_object") private String objectName; @@ -83,7 +87,22 @@ class Show extends TextBuiltin { private Integer renameLimit; @Option(name = "--name-status", usage = "usage_nameStatus") - private boolean showNameAndStatusOnly; + void nameAndStatusOnly(boolean on) { + if (showNameOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameAndStatusOnly = on; + } + + @Option(name = "--name-only", usage = "usage_nameOnly") + void nameOnly(boolean on) { + if (showNameAndStatusOnly) { + throw new IllegalArgumentException( + CLIText.get().cannotUseNameStatusOnlyAndNameOnly); + } + showNameOnly = on; + } @Option(name = "--ignore-space-at-eol") void ignoreSpaceAtEol(@SuppressWarnings("unused") boolean on) { @@ -302,9 +321,11 @@ class Show extends TextBuiltin { final RevTree a = c.getParent(0).getTree(); final RevTree b = c.getTree(); - if (showNameAndStatusOnly) + if (showNameAndStatusOnly) { Diff.nameStatus(outw, diffFmt.scan(a, b)); - else { + } else if (showNameOnly) { + Diff.nameOnly(outw, diffFmt.scan(a, b)); + } else { outw.flush(); diffFmt.format(a, b); diffFmt.flush(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java index 36103f2e6f..ac51643b6e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java @@ -42,12 +42,13 @@ class UploadPack extends TextBuiltin { try { FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED); db = key.open(true /* must exist */); - org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack( - db); - if (0 <= timeout) { - up.setTimeout(timeout); + try (org.eclipse.jgit.transport.UploadPack up = new org.eclipse.jgit.transport.UploadPack( + db)) { + if (0 <= timeout) { + up.setTimeout(timeout); + } + up.upload(ins, outs, errs); } - up.upload(ins, outs, errs); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, srcGitdir.getPath()), notFound); 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 e06f150e51..490f800c0d 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 @@ -119,6 +119,7 @@ public class CLIText extends TranslationBundle { /***/ public String cannotResolve; /***/ public String cannotSetupConsole; /***/ public String cannotUseObjectsWithGlog; + /***/ public String cannotUseNameStatusOnlyAndNameOnly; /***/ public String cantFindGitDirectory; /***/ public String cantWrite; /***/ public String changesNotStagedForCommit; |