diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-03-07 12:36:48 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2011-03-07 12:36:51 -0800 |
commit | ef822fe3cd26c61f87a8fce6fb5ac5e7a71e6108 (patch) | |
tree | 619519213d3599ff60c72033d7342cf4416cabed /org.eclipse.jgit.test/exttst | |
parent | 1f57061684c83623d7d08be9044fc9cfd7b9fb54 (diff) | |
download | jgit-ef822fe3cd26c61f87a8fce6fb5ac5e7a71e6108.tar.gz jgit-ef822fe3cd26c61f87a8fce6fb5ac5e7a71e6108.zip |
Remove deprecated Repository.mapTree
The mapTree() routines have been deprecated for a long time, and their
sibilings for mapCommit() and mapTag() were already removed from the
main Repository API.
Remove mapTree(). Application callers who only need the tree's name
can use resolve("^{tree}") syntax to resolve to the tree ObjectId, or
fail if the input is not a tree.
Applications that want to read a tree should use DirCache or TreeWalk.
Change-Id: I85726413790fc87721271c482f6636f81baf8b82
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/exttst')
-rw-r--r-- | org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java index 4c59d5a949..fac828822b 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java @@ -228,8 +228,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { assertEquals("c696abc3ab8e091c665f49d00eb8919690b3aec3", id.name()); GitIndex index2 = new GitIndex(db); - index2.readTree(db.mapTree(ObjectId.fromString( - "c696abc3ab8e091c665f49d00eb8919690b3aec3"))); + index2.readTree(mapTree("c696abc3ab8e091c665f49d00eb8919690b3aec3")); Entry[] members = index2.getMembers(); assertEquals(3, members.length); assertEquals("a.b", members[0].getName()); @@ -272,8 +271,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { assertEquals("ba78e065e2c261d4f7b8f42107588051e87e18e9", id.name()); GitIndex index2 = new GitIndex(db); - index2.readTree(db.mapTree(ObjectId.fromString( - "ba78e065e2c261d4f7b8f42107588051e87e18e9"))); + index2.readTree(mapTree("ba78e065e2c261d4f7b8f42107588051e87e18e9")); Entry[] members = index2.getMembers(); assertEquals(6, members.length); assertEquals("a.b", members[0].getName()); @@ -341,8 +339,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { GitIndex index2 = new GitIndex(db); assertEquals(0, index2.getMembers().length); - index2.readTree(db.mapTree(ObjectId.fromString( - "c696abc3ab8e091c665f49d00eb8919690b3aec3"))); + index2.readTree(mapTree("c696abc3ab8e091c665f49d00eb8919690b3aec3")); index2.checkout(trash); assertEquals("data:a/b", read(aslashb)); @@ -375,7 +372,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { index.filemode = Boolean.TRUE; // TODO: we need a way to set this using config index.add(trash, execFile); index.add(trash, nonexecFile); - Tree tree = db.mapTree(index.writeTree()); + Tree tree = mapTree(index.writeTree().name()); assertEquals(FileMode.EXECUTABLE_FILE, tree.findBlobMember(execFile.getName()).getMode()); assertEquals(FileMode.REGULAR_FILE, tree.findBlobMember(nonexecFile.getName()).getMode()); @@ -431,7 +428,7 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { index.filemode = Boolean.FALSE; // TODO: we need a way to set this using config index.add(trash, execFile); index.add(trash, nonexecFile); - Tree tree = db.mapTree(index.writeTree()); + Tree tree = mapTree(index.writeTree().name()); assertEquals(FileMode.REGULAR_FILE, tree.findBlobMember(execFile.getName()).getMode()); assertEquals(FileMode.REGULAR_FILE, tree.findBlobMember(nonexecFile.getName()).getMode()); @@ -476,4 +473,9 @@ public class T0007_GitIndexTest extends LocalDiskRepositoryTestCase { write(path, body); return path; } + + private Tree mapTree(String name) throws IOException { + ObjectId id = db.resolve(name + "^{tree}"); + return new Tree(db, id, db.open(id).getCachedBytes()); + } } |