diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-04-17 00:31:11 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-04-26 00:57:17 +0200 |
commit | 9dcd8c2c900722cbda7490c1a132fc4b96737c28 (patch) | |
tree | c27e3695683fca6d8fe8b59c785e6aaa04bd52be /org.eclipse.jgit.test | |
parent | 1c40d83f52730379e56b0a95485aad42a52b8e04 (diff) | |
download | jgit-9dcd8c2c900722cbda7490c1a132fc4b96737c28.tar.gz jgit-9dcd8c2c900722cbda7490c1a132fc4b96737c28.zip |
Make the Reflog a public API again
Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d
Diffstat (limited to 'org.eclipse.jgit.test')
8 files changed, 36 insertions, 37 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java index faaac55ea8..f66661a52f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java @@ -56,11 +56,11 @@ import org.eclipse.jgit.api.ResetCommand.ResetType; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.dircache.DirCache; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.lib.RepositoryState; import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason; import org.eclipse.jgit.revwalk.RevCommit; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java index e5680273c0..79d8f60441 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java @@ -56,12 +56,12 @@ import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.api.errors.NoMessageException; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.RefUpdate; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.util.FS; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ReflogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ReflogCommandTest.java index 318d1f98b9..b07c7033f5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ReflogCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ReflogCommandTest.java @@ -47,10 +47,10 @@ import static org.junit.Assert.assertNotNull; import java.util.Collection; -import org.eclipse.jgit.internal.storage.file.ReflogEntry; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.ReflogEntry; import org.eclipse.jgit.revwalk.RevCommit; import org.junit.Before; import org.junit.Test; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java index 01aaa7bd71..bb3e7a92e8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java @@ -57,11 +57,11 @@ import org.eclipse.jgit.api.ResetCommand.ResetType; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.dircache.DirCache; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.lib.RepositoryState; import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason; import org.eclipse.jgit.revwalk.RevCommit; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java index 322d47a091..030dc9f4a1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java @@ -54,13 +54,13 @@ import java.util.List; import org.eclipse.jgit.api.errors.UnmergedPathsException; import org.eclipse.jgit.diff.DiffEntry; -import org.eclipse.jgit.internal.storage.file.ReflogEntry; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; +import org.eclipse.jgit.lib.ReflogEntry; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.treewalk.TreeWalk; @@ -442,7 +442,7 @@ public class StashCreateCommandTest extends RepositoryTestCase { assertEquals("content", read(committedFile)); validateStashedCommit(stashed); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); ReflogEntry entry = reader.getLastEntry(); assertNotNull(entry); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java index 43f063f04d..cfad817d23 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java @@ -52,12 +52,12 @@ import java.io.File; import java.util.List; import org.eclipse.jgit.api.errors.JGitInternalException; -import org.eclipse.jgit.internal.storage.file.ReflogEntry; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; +import org.eclipse.jgit.lib.ReflogEntry; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.revwalk.RevCommit; import org.junit.Before; import org.junit.Test; @@ -126,9 +126,9 @@ public class StashDropCommandTest extends RepositoryTestCase { stashRef = git.getRepository().getRef(Constants.R_STASH); assertNull(stashRef); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); - assertTrue(reader.getReverseEntries().isEmpty()); + assertNull(reader); } @Test @@ -154,9 +154,9 @@ public class StashDropCommandTest extends RepositoryTestCase { assertNull(git.stashDrop().setAll(true).call()); assertNull(git.getRepository().getRef(Constants.R_STASH)); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); - assertTrue(reader.getReverseEntries().isEmpty()); + assertNull(reader); } @Test @@ -184,7 +184,7 @@ public class StashDropCommandTest extends RepositoryTestCase { assertNotNull(stashRef); assertEquals(firstStash, stashRef.getObjectId()); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); List<ReflogEntry> entries = reader.getReverseEntries(); assertEquals(1, entries.size()); @@ -226,7 +226,7 @@ public class StashDropCommandTest extends RepositoryTestCase { assertNotNull(stashRef); assertEquals(thirdStash, stashRef.getObjectId()); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); List<ReflogEntry> entries = reader.getReverseEntries(); assertEquals(2, entries.size()); @@ -284,7 +284,7 @@ public class StashDropCommandTest extends RepositoryTestCase { assertNotNull(stashRef); assertEquals(thirdStash, stashRef.getObjectId()); - ReflogReader reader = new ReflogReader(git.getRepository(), + ReflogReader reader = git.getRepository().getReflogReader( Constants.R_STASH); List<ReflogEntry> entries = reader.getReverseEntries(); assertEquals(2, entries.size()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java index 08e49d3dd5..7388dce237 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java @@ -61,11 +61,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.eclipse.jgit.internal.storage.file.FileRepository; -import org.eclipse.jgit.internal.storage.file.LockFile; -import org.eclipse.jgit.internal.storage.file.RefDirectory; -import org.eclipse.jgit.internal.storage.file.RefDirectoryUpdate; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.SampleDataRepositoryTestCase; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; @@ -75,6 +70,8 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefRename; import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.RefUpdate.Result; +import org.eclipse.jgit.lib.ReflogEntry; +import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; @@ -127,14 +124,16 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { assertNotSame(newid, r.getObjectId()); assertSame(ObjectId.class, r.getObjectId().getClass()); assertEquals(newid, r.getObjectId()); - List<org.eclipse.jgit.internal.storage.file.ReflogEntry> reverseEntries1 = db.getReflogReader("refs/heads/abc").getReverseEntries(); - org.eclipse.jgit.internal.storage.file.ReflogEntry entry1 = reverseEntries1.get(0); + List<ReflogEntry> reverseEntries1 = db + .getReflogReader("refs/heads/abc").getReverseEntries(); + ReflogEntry entry1 = reverseEntries1.get(0); assertEquals(1, reverseEntries1.size()); assertEquals(ObjectId.zeroId(), entry1.getOldId()); assertEquals(r.getObjectId(), entry1.getNewId()); assertEquals(new PersonIdent(db).toString(), entry1.getWho().toString()); assertEquals("", entry1.getComment()); - List<org.eclipse.jgit.internal.storage.file.ReflogEntry> reverseEntries2 = db.getReflogReader("HEAD").getReverseEntries(); + List<ReflogEntry> reverseEntries2 = db.getReflogReader("HEAD") + .getReverseEntries(); assertEquals(0, reverseEntries2.size()); } @@ -339,8 +338,8 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { // the branch HEAD referred to is left untouched assertEquals(pid, db.resolve("refs/heads/master")); - ReflogReader reflogReader = new ReflogReader(db, "HEAD"); - org.eclipse.jgit.internal.storage.file.ReflogEntry e = reflogReader.getReverseEntries().get(0); + ReflogReader reflogReader = db.getReflogReader("HEAD"); + ReflogEntry e = reflogReader.getReverseEntries().get(0); assertEquals(pid, e.getOldId()); assertEquals(ppid, e.getNewId()); assertEquals("GIT_COMMITTER_EMAIL", e.getWho().getEmailAddress()); @@ -369,8 +368,8 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { // the branch HEAD referred to is left untouched assertNull(db.resolve("refs/heads/unborn")); - ReflogReader reflogReader = new ReflogReader(db, "HEAD"); - org.eclipse.jgit.internal.storage.file.ReflogEntry e = reflogReader.getReverseEntries().get(0); + ReflogReader reflogReader = db.getReflogReader("HEAD"); + ReflogEntry e = reflogReader.getReverseEntries().get(0); assertEquals(ObjectId.zeroId(), e.getOldId()); assertEquals(ppid, e.getNewId()); assertEquals("GIT_COMMITTER_EMAIL", e.getWho().getEmailAddress()); @@ -706,9 +705,9 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { ObjectId oldfromId = db.resolve(fromName); ObjectId oldHeadId = db.resolve(Constants.HEAD); writeReflog(db, oldfromId, "Just a message", fromName); - List<org.eclipse.jgit.internal.storage.file.ReflogEntry> oldFromLog = db + List<ReflogEntry> oldFromLog = db .getReflogReader(fromName).getReverseEntries(); - List<org.eclipse.jgit.internal.storage.file.ReflogEntry> oldHeadLog = oldHeadId != null ? db + List<ReflogEntry> oldHeadLog = oldHeadId != null ? db .getReflogReader(Constants.HEAD).getReverseEntries() : null; assertTrue("internal check, we have a log", new File(db.getDirectory(), diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java index 65367a8c18..a0dff7ee86 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java @@ -55,13 +55,13 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.List; -import org.eclipse.jgit.internal.storage.file.CheckoutEntry; -import org.eclipse.jgit.internal.storage.file.ReflogEntry; -import org.eclipse.jgit.internal.storage.file.ReflogReader; import org.eclipse.jgit.junit.SampleDataRepositoryTestCase; +import org.eclipse.jgit.lib.CheckoutEntry; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; +import org.eclipse.jgit.lib.ReflogEntry; +import org.eclipse.jgit.lib.ReflogReader; import org.junit.Test; public class ReflogReaderTest extends SampleDataRepositoryTestCase { @@ -97,7 +97,7 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { public void testReadOneLine() throws Exception { setupReflog("logs/refs/heads/master", oneLine); - ReflogReader reader = new ReflogReader(db, "refs/heads/master"); + ReflogReader reader = new ReflogReaderImpl(db, "refs/heads/master"); ReflogEntry e = reader.getLastEntry(); assertEquals(ObjectId .fromString("da85355dfc525c9f6f3927b876f379f46ccf826e"), e @@ -124,7 +124,7 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { public void testReadTwoLine() throws Exception { setupReflog("logs/refs/heads/master", twoLine); - ReflogReader reader = new ReflogReader(db, "refs/heads/master"); + ReflogReader reader = new ReflogReaderImpl(db, "refs/heads/master"); List<ReflogEntry> reverseEntries = reader.getReverseEntries(); assertEquals(2, reverseEntries.size()); ReflogEntry e = reverseEntries.get(0); @@ -159,7 +159,7 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { @Test public void testReadWhileAppendIsInProgress() throws Exception { setupReflog("logs/refs/heads/master", twoLineWithAppendInProgress); - ReflogReader reader = new ReflogReader(db, "refs/heads/master"); + ReflogReader reader = new ReflogReaderImpl(db, "refs/heads/master"); List<ReflogEntry> reverseEntries = reader.getReverseEntries(); assertEquals(2, reverseEntries.size()); ReflogEntry e = reverseEntries.get(0); @@ -236,7 +236,7 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { public void testSpecificEntryNumber() throws Exception { setupReflog("logs/refs/heads/master", twoLine); - ReflogReader reader = new ReflogReader(db, "refs/heads/master"); + ReflogReader reader = new ReflogReaderImpl(db, "refs/heads/master"); ReflogEntry e = reader.getReverseEntry(0); assertEquals( ObjectId.fromString("c6734895958052a9dbc396cff4459dc1a25029ab"), |