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>
This commit is contained in:
parent
b7e8cefc92
commit
3a9295b894
|
@ -74,6 +74,8 @@
|
||||||
* @see SideBandOutputStream
|
* @see SideBandOutputStream
|
||||||
*/
|
*/
|
||||||
class SideBandInputStream extends InputStream {
|
class SideBandInputStream extends InputStream {
|
||||||
|
private static final String PFX_REMOTE = "remote: ";
|
||||||
|
|
||||||
static final int CH_DATA = 1;
|
static final int CH_DATA = 1;
|
||||||
|
|
||||||
static final int CH_PROGRESS = 2;
|
static final int CH_PROGRESS = 2;
|
||||||
|
@ -161,7 +163,7 @@ private void needDataPacket() throws IOException {
|
||||||
continue;
|
continue;
|
||||||
case CH_ERROR:
|
case CH_ERROR:
|
||||||
eof = true;
|
eof = true;
|
||||||
throw new TransportException("remote: " + readString(available));
|
throw new TransportException(PFX_REMOTE + readString(available));
|
||||||
default:
|
default:
|
||||||
throw new PackProtocolException("Invalid channel " + channel);
|
throw new PackProtocolException("Invalid channel " + channel);
|
||||||
}
|
}
|
||||||
|
@ -201,8 +203,7 @@ private boolean doProgressLine(final String msg) {
|
||||||
if (!currentTask.equals(taskname)) {
|
if (!currentTask.equals(taskname)) {
|
||||||
currentTask = taskname;
|
currentTask = taskname;
|
||||||
lastCnt = 0;
|
lastCnt = 0;
|
||||||
final int tot = Integer.parseInt(matcher.group(3));
|
beginTask(Integer.parseInt(matcher.group(3)));
|
||||||
monitor.beginTask(currentTask, tot);
|
|
||||||
}
|
}
|
||||||
final int cnt = Integer.parseInt(matcher.group(2));
|
final int cnt = Integer.parseInt(matcher.group(2));
|
||||||
monitor.update(cnt - lastCnt);
|
monitor.update(cnt - lastCnt);
|
||||||
|
@ -216,7 +217,7 @@ private boolean doProgressLine(final String msg) {
|
||||||
if (!currentTask.equals(taskname)) {
|
if (!currentTask.equals(taskname)) {
|
||||||
currentTask = taskname;
|
currentTask = taskname;
|
||||||
lastCnt = 0;
|
lastCnt = 0;
|
||||||
monitor.beginTask(currentTask, ProgressMonitor.UNKNOWN);
|
beginTask(ProgressMonitor.UNKNOWN);
|
||||||
}
|
}
|
||||||
final int cnt = Integer.parseInt(matcher.group(2));
|
final int cnt = Integer.parseInt(matcher.group(2));
|
||||||
monitor.update(cnt - lastCnt);
|
monitor.update(cnt - lastCnt);
|
||||||
|
@ -227,6 +228,10 @@ private boolean doProgressLine(final String msg) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void beginTask(final int totalWorkUnits) {
|
||||||
|
monitor.beginTask(PFX_REMOTE + currentTask, totalWorkUnits);
|
||||||
|
}
|
||||||
|
|
||||||
private String readString(final int len) throws IOException {
|
private String readString(final int len) throws IOException {
|
||||||
final byte[] raw = new byte[len];
|
final byte[] raw = new byte[len];
|
||||||
IO.readFully(rawIn, raw, 0, len);
|
IO.readFully(rawIn, raw, 0, len);
|
||||||
|
|
Loading…
Reference in New Issue