@ -71,6 +71,8 @@ final class PackWriterBitmapWalker {
private final ProgressMonitor pm ;
private final ProgressMonitor pm ;
private long countOfBitmapIndexMisses ;
PackWriterBitmapWalker (
PackWriterBitmapWalker (
ObjectWalk walker , BitmapIndex bitmapIndex , ProgressMonitor pm ) {
ObjectWalk walker , BitmapIndex bitmapIndex , ProgressMonitor pm ) {
this . walker = walker ;
this . walker = walker ;
@ -78,6 +80,10 @@ final class PackWriterBitmapWalker {
this . pm = ( pm = = null ) ? NullProgressMonitor . INSTANCE : pm ;
this . pm = ( pm = = null ) ? NullProgressMonitor . INSTANCE : pm ;
}
}
long getCountOfBitmapIndexMisses ( ) {
return countOfBitmapIndexMisses ;
}
BitmapBuilder findObjects ( Set < ? extends ObjectId > start , BitmapBuilder seen , boolean ignoreMissingStart )
BitmapBuilder findObjects ( Set < ? extends ObjectId > start , BitmapBuilder seen , boolean ignoreMissingStart )
throws MissingObjectException , IncorrectObjectTypeException ,
throws MissingObjectException , IncorrectObjectTypeException ,
IOException {
IOException {
@ -104,7 +110,8 @@ final class PackWriterBitmapWalker {
}
}
if ( marked ) {
if ( marked ) {
walker . setRevFilter ( newRevFilter ( seen , bitmapResult ) ) ;
BitmapRevFilter filter = newRevFilter ( seen , bitmapResult ) ;
walker . setRevFilter ( filter ) ;
while ( walker . next ( ) ! = null ) {
while ( walker . next ( ) ! = null ) {
// Iterate through all of the commits. The BitmapRevFilter does
// Iterate through all of the commits. The BitmapRevFilter does
@ -117,6 +124,7 @@ final class PackWriterBitmapWalker {
bitmapResult . add ( ro , ro . getType ( ) ) ;
bitmapResult . add ( ro , ro . getType ( ) ) ;
pm . update ( 1 ) ;
pm . update ( 1 ) ;
}
}
countOfBitmapIndexMisses + = filter . getCountOfLoadedCommits ( ) ;
}
}
return bitmapResult ;
return bitmapResult ;
@ -126,7 +134,7 @@ final class PackWriterBitmapWalker {
walker . reset ( ) ;
walker . reset ( ) ;
}
}
static RevFilter newRevFilter (
static Bitmap RevFilter newRevFilter (
final BitmapBuilder seen , final BitmapBuilder bitmapResult ) {
final BitmapBuilder seen , final BitmapBuilder bitmapResult ) {
if ( seen ! = null ) {
if ( seen ! = null ) {
return new BitmapRevFilter ( ) {
return new BitmapRevFilter ( ) {
@ -146,12 +154,16 @@ final class PackWriterBitmapWalker {
}
}
static abstract class BitmapRevFilter extends RevFilter {
static abstract class BitmapRevFilter extends RevFilter {
private long countOfLoadedCommits ;
protected abstract boolean load ( RevCommit cmit ) ;
protected abstract boolean load ( RevCommit cmit ) ;
@Override
@Override
public final boolean include ( RevWalk walker , RevCommit cmit ) {
public final boolean include ( RevWalk walker , RevCommit cmit ) {
if ( load ( cmit ) )
if ( load ( cmit ) ) {
countOfLoadedCommits + + ;
return true ;
return true ;
}
for ( RevCommit p : cmit . getParents ( ) )
for ( RevCommit p : cmit . getParents ( ) )
p . add ( RevFlag . SEEN ) ;
p . add ( RevFlag . SEEN ) ;
return false ;
return false ;
@ -166,5 +178,9 @@ final class PackWriterBitmapWalker {
public final boolean requiresCommitBody ( ) {
public final boolean requiresCommitBody ( ) {
return false ;
return false ;
}
}
long getCountOfLoadedCommits ( ) {
return countOfLoadedCommits ;
}
}
}
}
}