|
|
@ -229,6 +229,42 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { |
|
|
|
assertEquals("new/work", checkout.getFromBranch()); |
|
|
|
assertEquals("new/work", checkout.getFromBranch()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testSpecificEntryNumber() throws Exception { |
|
|
|
|
|
|
|
setupReflog("logs/refs/heads/master", twoLine); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReflogReader reader = new ReflogReader(db, "refs/heads/master"); |
|
|
|
|
|
|
|
ReflogEntry e = reader.getReverseEntry(0); |
|
|
|
|
|
|
|
assertEquals( |
|
|
|
|
|
|
|
ObjectId.fromString("c6734895958052a9dbc396cff4459dc1a25029ab"), |
|
|
|
|
|
|
|
e.getOldId()); |
|
|
|
|
|
|
|
assertEquals( |
|
|
|
|
|
|
|
ObjectId.fromString("54794942a18a237c57a80719afed44bb78172b10"), |
|
|
|
|
|
|
|
e.getNewId()); |
|
|
|
|
|
|
|
assertEquals("Same A U Thor", e.getWho().getName()); |
|
|
|
|
|
|
|
assertEquals("same.author@example.com", e.getWho().getEmailAddress()); |
|
|
|
|
|
|
|
assertEquals(60, e.getWho().getTimeZoneOffset()); |
|
|
|
|
|
|
|
assertEquals("2009-05-22T22:36:42", iso(e.getWho())); |
|
|
|
|
|
|
|
assertEquals( |
|
|
|
|
|
|
|
"rebase finished: refs/heads/rr/renamebranch5 onto c6e3b9fe2da0293f11eae202ec35fb343191a82d", |
|
|
|
|
|
|
|
e.getComment()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e = reader.getReverseEntry(1); |
|
|
|
|
|
|
|
assertEquals( |
|
|
|
|
|
|
|
ObjectId.fromString("0000000000000000000000000000000000000000"), |
|
|
|
|
|
|
|
e.getOldId()); |
|
|
|
|
|
|
|
assertEquals( |
|
|
|
|
|
|
|
ObjectId.fromString("c6734895958052a9dbc396cff4459dc1a25029ab"), |
|
|
|
|
|
|
|
e.getNewId()); |
|
|
|
|
|
|
|
assertEquals("A U Thor", e.getWho().getName()); |
|
|
|
|
|
|
|
assertEquals("thor@committer.au", e.getWho().getEmailAddress()); |
|
|
|
|
|
|
|
assertEquals(-60, e.getWho().getTimeZoneOffset()); |
|
|
|
|
|
|
|
assertEquals("2009-05-22T20:36:41", iso(e.getWho())); |
|
|
|
|
|
|
|
assertEquals("branch: Created from rr/renamebranchv4", e.getComment()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertNull(reader.getReverseEntry(3)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setupReflog(String logName, byte[] data) |
|
|
|
private void setupReflog(String logName, byte[] data) |
|
|
|
throws FileNotFoundException, IOException { |
|
|
|
throws FileNotFoundException, IOException { |
|
|
|
File logfile = new File(db.getDirectory(), logName); |
|
|
|
File logfile = new File(db.getDirectory(), logName); |
|
|
|