public virtual void LogAllCommits() { IList<RevCommit> commits = new AList<RevCommit>(); Git git = Git.Wrap(db); WriteTrashFile("Test.txt", "Hello world"); git.Add().AddFilepattern("Test.txt").Call(); commits.AddItem(git.Commit().SetMessage("initial commit").Call()); git.BranchCreate().SetName("branch1").Call(); Ref checkedOut = git.Checkout().SetName("branch1").Call(); NUnit.Framework.Assert.AreEqual("refs/heads/branch1", checkedOut.GetName()); WriteTrashFile("Test1.txt", "Hello world!"); git.Add().AddFilepattern("Test1.txt").Call(); commits.AddItem(git.Commit().SetMessage("branch1 commit").Call()); checkedOut = git.Checkout().SetName("master").Call(); NUnit.Framework.Assert.AreEqual("refs/heads/master", checkedOut.GetName()); WriteTrashFile("Test2.txt", "Hello world!!"); git.Add().AddFilepattern("Test2.txt").Call(); commits.AddItem(git.Commit().SetMessage("branch1 commit").Call()); Iterator<RevCommit> log = git.Log().All().Call().Iterator(); NUnit.Framework.Assert.IsTrue(log.HasNext()); NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next())); NUnit.Framework.Assert.IsTrue(log.HasNext()); NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next())); NUnit.Framework.Assert.IsTrue(log.HasNext()); NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next())); NUnit.Framework.Assert.IsFalse(log.HasNext()); }
/// <summary> /// Gets the principal variation and the best move from the transposition /// table /// </summary> private void GetPv() { StringBuilder sb = new StringBuilder(); IList<long> keys = new AList<long>(); // To not repeat keys int i = 0; while (i < 256) { if (tt.Search(board, false)) { if (keys.Contains(board.GetKey())) { break; } keys.AddItem(board.GetKey()); if (tt.GetBestMove() == 0) { break; } if (i == 0) { globalBestMove = tt.GetBestMove(); } else { if (i == 1) { ponderMove = tt.GetBestMove(); } } sb.Append(Move.ToString(tt.GetBestMove())); sb.Append(" "); i++; board.DoMove(tt.GetBestMove(), false); } else { break; } } // Now undo moves for (int j = 0; j < i; j++) { board.UndoMove(); } pv = sb.ToString(); }