Remove Repository.toFile(ObjectId)
Not every type of Repository will be able to map an ObjectId into a local file system path that stores that object's file contents. Heck, its not even true for the FileRepository, as an object can be stored in a pack file and not in its loose format. Remove this from our public API, it was a mistake to publish it. Change-Id: I20d1b8c39104023936e6d46a5b0d7ef39ff118e8 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
41c04bbb28
commit
8f46ee4870
|
@ -365,8 +365,10 @@ public void test009_CreateCommitOldFormat() throws IOException {
|
||||||
assertEquals(cmtid, c.getCommitId());
|
assertEquals(cmtid, c.getCommitId());
|
||||||
|
|
||||||
// Verify the commit we just wrote is in the correct format.
|
// Verify the commit we just wrote is in the correct format.
|
||||||
final XInputStream xis = new XInputStream(new FileInputStream(db
|
ObjectDatabase odb = db.getObjectDatabase();
|
||||||
.toFile(cmtid)));
|
assertTrue("is ObjectDirectory", odb instanceof ObjectDirectory);
|
||||||
|
final XInputStream xis = new XInputStream(new FileInputStream(
|
||||||
|
((ObjectDirectory) odb).fileFor(cmtid)));
|
||||||
try {
|
try {
|
||||||
assertEquals(0x78, xis.readUInt8());
|
assertEquals(0x78, xis.readUInt8());
|
||||||
assertEquals(0x9c, xis.readUInt8());
|
assertEquals(0x9c, xis.readUInt8());
|
||||||
|
|
|
@ -380,20 +380,6 @@ public FileBasedConfig getConfig() {
|
||||||
return repoConfig;
|
return repoConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a filename where the loose object having a specified SHA-1
|
|
||||||
* should be stored. If the object is stored in a shared repository the path
|
|
||||||
* to the alternative repo will be returned. If the object is not yet store
|
|
||||||
* a usable path in this repo will be returned. It is assumed that callers
|
|
||||||
* will look for objects in a pack first.
|
|
||||||
*
|
|
||||||
* @param objectId
|
|
||||||
* @return suggested file name
|
|
||||||
*/
|
|
||||||
public File toFile(final AnyObjectId objectId) {
|
|
||||||
return objectDatabase.fileFor(objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Objects known to exist but not expressed by {@link #getAllRefs()}.
|
* Objects known to exist but not expressed by {@link #getAllRefs()}.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -173,18 +173,6 @@ public FS getFS() {
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a filename where the loose object having a specified SHA-1
|
|
||||||
* should be stored. If the object is stored in a shared repository the path
|
|
||||||
* to the alternative repo will be returned. If the object is not yet store
|
|
||||||
* a usable path in this repo will be returned. It is assumed that callers
|
|
||||||
* will look for objects in a pack first.
|
|
||||||
*
|
|
||||||
* @param objectId
|
|
||||||
* @return suggested file name
|
|
||||||
*/
|
|
||||||
public abstract File toFile(AnyObjectId objectId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param objectId
|
* @param objectId
|
||||||
* @return true if the specified object is stored in this repo or any of the
|
* @return true if the specified object is stored in this repo or any of the
|
||||||
|
|
Loading…
Reference in New Issue