@ -47,6 +47,7 @@ package org.eclipse.jgit.transport;
import java.io.IOException ;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.InputStream ;
import java.io.OutputStream ;
import java.text.MessageFormat ;
import java.text.MessageFormat ;
import java.util.Collection ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.Collections ;
@ -59,13 +60,13 @@ import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.PackLock ;
import org.eclipse.jgit.internal.storage.file.PackLock ;
import org.eclipse.jgit.lib.AnyObjectId ;
import org.eclipse.jgit.lib.AnyObjectId ;
import org.eclipse.jgit.lib.Config ;
import org.eclipse.jgit.lib.Config ;
import org.eclipse.jgit.lib.Config.SectionParser ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.Constants ;
import org.eclipse.jgit.lib.MutableObjectId ;
import org.eclipse.jgit.lib.MutableObjectId ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectInserter ;
import org.eclipse.jgit.lib.ObjectInserter ;
import org.eclipse.jgit.lib.ProgressMonitor ;
import org.eclipse.jgit.lib.ProgressMonitor ;
import org.eclipse.jgit.lib.Ref ;
import org.eclipse.jgit.lib.Ref ;
import org.eclipse.jgit.lib.Config.SectionParser ;
import org.eclipse.jgit.revwalk.RevCommit ;
import org.eclipse.jgit.revwalk.RevCommit ;
import org.eclipse.jgit.revwalk.RevCommitList ;
import org.eclipse.jgit.revwalk.RevCommitList ;
import org.eclipse.jgit.revwalk.RevFlag ;
import org.eclipse.jgit.revwalk.RevFlag ;
@ -265,8 +266,17 @@ public abstract class BasePackFetchConnection extends BasePackConnection
public final void fetch ( final ProgressMonitor monitor ,
public final void fetch ( final ProgressMonitor monitor ,
final Collection < Ref > want , final Set < ObjectId > have )
final Collection < Ref > want , final Set < ObjectId > have )
throws TransportException {
throws TransportException {
fetch ( monitor , want , have , null ) ;
}
/ * *
* @since 3 . 0
* /
public final void fetch ( final ProgressMonitor monitor ,
final Collection < Ref > want , final Set < ObjectId > have ,
OutputStream outputStream ) throws TransportException {
markStartedOperation ( ) ;
markStartedOperation ( ) ;
doFetch ( monitor , want , have ) ;
doFetch ( monitor , want , have , outputStream ) ;
}
}
public boolean didFetchIncludeTags ( ) {
public boolean didFetchIncludeTags ( ) {
@ -298,12 +308,15 @@ public abstract class BasePackFetchConnection extends BasePackConnection
* additional objects to assume that already exist locally . This
* additional objects to assume that already exist locally . This
* will be added to the set of objects reachable from the
* will be added to the set of objects reachable from the
* destination repository ' s references .
* destination repository ' s references .
* @param outputStream
* ouputStream to write sideband messages to
* @throws TransportException
* @throws TransportException
* if any exception occurs .
* if any exception occurs .
* @since 3 . 0
* /
* /
protected void doFetch ( final ProgressMonitor monitor ,
protected void doFetch ( final ProgressMonitor monitor ,
final Collection < Ref > want , final Set < ObjectId > have )
final Collection < Ref > want , final Set < ObjectId > have ,
throws TransportException {
OutputStream outputStream ) throws TransportException {
try {
try {
markRefsAdvertised ( ) ;
markRefsAdvertised ( ) ;
markReachable ( have , maxTimeWanted ( want ) ) ;
markReachable ( have , maxTimeWanted ( want ) ) ;
@ -321,7 +334,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
state = null ;
state = null ;
pckState = null ;
pckState = null ;
receivePack ( monitor ) ;
receivePack ( monitor , outputStream ) ;
}
}
} catch ( CancelledException ce ) {
} catch ( CancelledException ce ) {
close ( ) ;
close ( ) ;
@ -702,11 +715,13 @@ public abstract class BasePackFetchConnection extends BasePackConnection
( ( RevCommit ) obj ) . carry ( COMMON ) ;
( ( RevCommit ) obj ) . carry ( COMMON ) ;
}
}
private void receivePack ( final ProgressMonitor monitor ) throws IOException {
private void receivePack ( final ProgressMonitor monitor ,
OutputStream outputStream ) throws IOException {
onReceivePack ( ) ;
onReceivePack ( ) ;
InputStream input = in ;
InputStream input = in ;
if ( sideband )
if ( sideband )
input = new SideBandInputStream ( input , monitor , getMessageWriter ( ) ) ;
input = new SideBandInputStream ( input , monitor , getMessageWriter ( ) ,
outputStream ) ;
ObjectInserter ins = local . newObjectInserter ( ) ;
ObjectInserter ins = local . newObjectInserter ( ) ;
try {
try {