diff options
author | Shawn Pearce | 2016-01-01 00:03:13 +0000 |
---|---|---|
committer | Shawn Pearce | 2016-01-01 01:37:16 +0000 |
commit | c426a964ed41001731288d4fb8c26bdda2cfe169 (patch) | |
tree | df0bf642bd5798f5d3daf5e8588a50edbc86bf60 | |
parent | 2f8d787b5f691bd55584fb74556d408301ddb788 (diff) | |
download | jgit-c426a964ed41001731288d4fb8c26bdda2cfe169.tar.gz jgit-c426a964ed41001731288d4fb8c26bdda2cfe169.tar.xz jgit-c426a964ed41001731288d4fb8c26bdda2cfe169.zip |
clone: display progress messages
Also support -q/--quiet flag to disable progress.
Change-Id: I979277502c990f6dec052d095461c996ff8fe577
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index cd6953cb05..04078287fb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -50,6 +50,7 @@ import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.TextProgressMonitor; import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.util.SystemReader; @@ -70,6 +71,9 @@ class Clone extends AbstractFetchCommand { @Option(name = "--bare", usage = "usage_bareClone") private boolean isBare; + @Option(name = "--quiet", usage = "usage_quiet") + private Boolean quiet; + @Argument(index = 0, required = true, metaVar = "metaVar_uriish") private String sourceUri; @@ -109,10 +113,16 @@ class Clone extends AbstractFetchCommand { command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localNameF); - outw.println(MessageFormat.format(CLIText.get().cloningInto, localName)); + boolean msgs = quiet == null || !quiet.booleanValue(); + if (msgs) { + command.setProgressMonitor(new TextProgressMonitor(errw)); + outw.println(MessageFormat.format( + CLIText.get().cloningInto, localName)); + outw.flush(); + } try { db = command.call().getRepository(); - if (db.resolve(Constants.HEAD) == null) + if (msgs && db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, @@ -121,8 +131,9 @@ class Clone extends AbstractFetchCommand { if (db != null) db.close(); } - - outw.println(); - outw.flush(); + if (msgs) { + outw.println(); + outw.flush(); + } } } |