diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-02-09 10:39:15 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-03-12 16:08:13 -0800 |
commit | 3a9295b8942639b8ac9f161a84b20fe15896e6b6 (patch) | |
tree | 3f3d5a15f0efcaef17fb25f4c66b1daa749bc2b9 /org.eclipse.jgit | |
parent | b7e8cefc9216ee852499cb15935f879df1e1e3b7 (diff) | |
download | jgit-3a9295b8942639b8ac9f161a84b20fe15896e6b6.tar.gz jgit-3a9295b8942639b8ac9f161a84b20fe15896e6b6.zip |
Prefix remote progress tasks with "remote: "
When we pull task messages off the remote peer via sideband #2
prefix them with the string "remote: " to make it clear to the
user these are coming from the other system, and not from their
local client.
Change-Id: I02c5e67c6be67e30e40d3bc4be314d6640feb519
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java index 5f3b34e6fa..dadc0638b3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java @@ -74,6 +74,8 @@ import org.eclipse.jgit.util.RawParseUtils; * @see SideBandOutputStream */ class SideBandInputStream extends InputStream { + private static final String PFX_REMOTE = "remote: "; + static final int CH_DATA = 1; static final int CH_PROGRESS = 2; @@ -161,7 +163,7 @@ class SideBandInputStream extends InputStream { continue; case CH_ERROR: eof = true; - throw new TransportException("remote: " + readString(available)); + throw new TransportException(PFX_REMOTE + readString(available)); default: throw new PackProtocolException("Invalid channel " + channel); } @@ -201,8 +203,7 @@ class SideBandInputStream extends InputStream { if (!currentTask.equals(taskname)) { currentTask = taskname; lastCnt = 0; - final int tot = Integer.parseInt(matcher.group(3)); - monitor.beginTask(currentTask, tot); + beginTask(Integer.parseInt(matcher.group(3))); } final int cnt = Integer.parseInt(matcher.group(2)); monitor.update(cnt - lastCnt); @@ -216,7 +217,7 @@ class SideBandInputStream extends InputStream { if (!currentTask.equals(taskname)) { currentTask = taskname; lastCnt = 0; - monitor.beginTask(currentTask, ProgressMonitor.UNKNOWN); + beginTask(ProgressMonitor.UNKNOWN); } final int cnt = Integer.parseInt(matcher.group(2)); monitor.update(cnt - lastCnt); @@ -227,6 +228,10 @@ class SideBandInputStream extends InputStream { return false; } + private void beginTask(final int totalWorkUnits) { + monitor.beginTask(PFX_REMOTE + currentTask, totalWorkUnits); + } + private String readString(final int len) throws IOException { final byte[] raw = new byte[len]; IO.readFully(rawIn, raw, 0, len); |