public void Push_LocalOnNewBranch_DoesNotThrow() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.SetLocalAdjunct(new BranchTestAdjunct() { BranchName = "newLocalBranch" }); e.LocalAddAndCommit(); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Nothing); } }
public void Push_OneLocalChangeNothingToPullOn2BranchRemote_Success() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.SetLocalAdjunct(new BranchTestAdjunct { BranchName = "branch2" }); e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.LocalAddAndCommit(); var transport = provider.Transport; transport.Push(); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Pull_RemoteOnNewBranch_Success() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Pull)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.SetRemoteAdjunct(new BranchTestAdjunct { BranchName = "remoteBranch" }); e.LocalAddAndCommit(); e.RemoteAddAndCommit(); var transport = provider.Transport; transport.Pull(); Assert.That(e.Progress.AllMessages, Contains.Item("Pull operation completed successfully")); } }
public void Push_LocalOnNewBranchRevisionsExceedQuantity_SendsData() { using (var e = new BranchingTestEnvironment("localonnewbranch", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.SetLocalAdjunct(new BranchTestAdjunct() { BranchName = "newLocalBranch" }); e.RemoteAddAndCommit(); e.LocalAddAndCommit(); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Nothing); Assert.That(e.Progress.AllMessages, !Contains.Item("No changes to send. Push operation completed")); } }
public void Push_RemoteRevisionCacheWorksWhenReceivingMoreThanRequestedRevisions() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Dummy)) using (var provider = GetTransportProviderForTest(e)) { provider.Transport.RevisionRequestQuantity = 2; var first2revs = ""; var changingFile = e.LocalAddAndCommit(); first2revs += e.Local.Repository.GetTip().Number.Hash + ':' + e.Local.Repository.GetTip().Branch + "|"; e.LocalChangeAndCommit(changingFile); first2revs += e.Local.Repository.GetTip().Number.Hash + ':' + e.Local.Repository.GetTip().Branch; var second2revs = ""; e.LocalChangeAndCommit(changingFile); second2revs += e.Local.Repository.GetTip().Number.Hash + ':' + e.Local.Repository.GetTip().Branch + "|"; e.LocalChangeAndCommit(changingFile); second2revs += e.Local.Repository.GetTip().Number.Hash + ':' + e.Local.Repository.GetTip().Branch; e.ApiServer.AddResponse(ApiResponses.Revisions(first2revs)); e.ApiServer.AddResponse(ApiResponses.Revisions(second2revs)); e.ApiServer.AddResponse(ApiResponses.Revisions("")); e.SetLocalAdjunct(new ProgrammableSynchronizerAdjunct("newbranch")); e.LocalAddAndCommit(); e.ApiServer.AddResponse(ApiResponses.PushComplete()); var transport = provider.Transport; var dbStoragePath = transport.PathToLocalStorage; var dbFilePath = Path.Combine(dbStoragePath, HgResumeTransport.RevisionCacheFilename); Assert.That(File.Exists(dbFilePath), Is.False); var tipHash = e.Local.Repository.GetTip().Number.Hash; var cacheContents = HgResumeTransport.ReadServerRevisionCache(dbFilePath); transport.Push(); Assert.That(File.Exists(dbFilePath), Is.True); cacheContents = HgResumeTransport.ReadServerRevisionCache(dbFilePath); Assert.True(cacheContents.Count == 2, "should be 2 entries in the cache at this point."); Assert.True(cacheContents.FirstOrDefault().RemoteId == e.ApiServer.Host && cacheContents.FirstOrDefault().Revision.Number.Hash == tipHash, "Cache contents incorrect"); Assert.That(e.Progress.AllMessages, Contains.Item("Finished sending")); } }
public void Push_RemoteOnNewBranch_SendsData() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.SetRemoteAdjunct(new BranchTestAdjunct() { BranchName = "newRemoteBranch" }); e.RemoteAddAndCommit(); e.LocalAddAndCommit(); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Nothing); Assert.That(e.Progress.AllMessages, !Contains.Item("No changes to send. Push operation completed")); } }
public void Push_RemoteOnNewBranch_DoesNotThrow() { using (var e = new BranchingTestEnvironment("hgresumetest", ApiServerType.Push)) using (var provider = GetTransportProviderForTest(e)) { e.LocalAddAndCommit(); e.CloneRemoteFromLocal(); e.SetRemoteAdjunct(new BranchTestAdjunct() { BranchName = "newRemoteBranch"}); e.RemoteAddAndCommit(); var transport = provider.Transport; Assert.That(() => transport.Push(), Throws.Nothing); } }