Browse Source

PackWriter: Rename getObjectsNumber to getObjectCount

This better matches with PackFile and CachedPack's methods
that return the same value.

Change-Id: Idb9b7c71d2048dd2344a62c2cde20b4e34529ab7
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.12
Shawn O. Pearce 14 years ago
parent
commit
7a9bf1e2e0
  1. 16
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java
  2. 4
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
  3. 2
      org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java

16
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java

@ -133,7 +133,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
assertEquals(false, writer.isDeltaBaseAsOffset());
assertEquals(true, config.isReuseDeltas());
assertEquals(true, config.isReuseObjects());
assertEquals(0, writer.getObjectsNumber());
assertEquals(0, writer.getObjectCount());
}
/**
@ -164,7 +164,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
public void testWriteEmptyPack1() throws IOException {
createVerifyOpenPack(EMPTY_LIST_OBJECT, EMPTY_LIST_OBJECT, false, false);
assertEquals(0, writer.getObjectsNumber());
assertEquals(0, writer.getObjectCount());
assertEquals(0, pack.getObjectCount());
assertEquals("da39a3ee5e6b4b0d3255bfef95601890afd80709", writer
.computeName().name());
@ -180,7 +180,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
public void testWriteEmptyPack2() throws IOException {
createVerifyOpenPack(EMPTY_LIST_REVS);
assertEquals(0, writer.getObjectsNumber());
assertEquals(0, writer.getObjectCount());
assertEquals(0, pack.getObjectCount());
}
@ -323,7 +323,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
createVerifyOpenPack(Arrays.asList(forcedOrderRevs));
assertEquals(forcedOrder.length, writer.getObjectsNumber());
assertEquals(forcedOrder.length, writer.getObjectCount());
verifyObjectsOrder(forcedOrder);
assertEquals("ed3f96b8327c7c66b0f8f70056129f0769323d86", writer
.computeName().name());
@ -466,7 +466,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
ObjectId.fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259"),
ObjectId.fromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3") };
assertEquals(expectedOrder.length, writer.getObjectsNumber());
assertEquals(expectedOrder.length, writer.getObjectCount());
verifyObjectsOrder(expectedOrder);
assertEquals("34be9032ac282b11fa9babdc2b2a93ca996c9c2f", writer
.computeName().name());
@ -495,7 +495,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
expectedOrder[4] = expectedOrder[5];
expectedOrder[5] = temp;
}
assertEquals(expectedOrder.length, writer.getObjectsNumber());
assertEquals(expectedOrder.length, writer.getObjectCount());
verifyObjectsOrder(expectedOrder);
assertEquals("ed3f96b8327c7c66b0f8f70056129f0769323d86", writer
.computeName().name());
@ -514,7 +514,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
ObjectId.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"),
ObjectId.fromString("aabf2ffaec9b497f0950352b3e582d73035c2035"),
ObjectId.fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259") };
assertEquals(writtenObjects.length, writer.getObjectsNumber());
assertEquals(writtenObjects.length, writer.getObjectCount());
ObjectId expectedObjects[];
if (thin) {
expectedObjects = new ObjectId[4];
@ -550,7 +550,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
NullProgressMonitor m = NullProgressMonitor.INSTANCE;
writer = new PackWriter(config, db.newObjectReader());
writer.preparePack(objectSource.iterator());
assertEquals(objectSource.size(), writer.getObjectsNumber());
assertEquals(objectSource.size(), writer.getObjectCount());
writer.writePack(m, m, os);
writer.release();
verifyOpenPack(false);

4
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -405,7 +405,7 @@ public class PackWriter {
* @throws IOException
* a cached pack cannot supply its object count.
*/
public long getObjectsNumber() throws IOException {
public long getObjectCount() throws IOException {
if (stats.totalObjects == 0) {
long objCnt = 0;
for (List<ObjectToPack> list : objectsLists)
@ -645,7 +645,7 @@ public class PackWriter {
final PackOutputStream out = new PackOutputStream(writeMonitor,
packStream, this);
long objCnt = getObjectsNumber();
long objCnt = getObjectCount();
stats.totalObjects = objCnt;
writeMonitor.beginTask(JGitText.get().writingObjects, (int) objCnt);
long writeStart = System.currentTimeMillis();

2
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java

@ -230,7 +230,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
// be an empty pack, as the remote has all objects it
// needs to complete this change.
//
if (writer.getObjectsNumber() == 0)
if (writer.getObjectCount() == 0)
return;
packNames = new LinkedHashMap<String, String>();

Loading…
Cancel
Save