public void Sync_ExceptionInMergeCode_LeftWith2HeadsAndErrorOutputToProgress()
        {
            using (RepositoryWithFilesSetup bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");
                    using (new FailureSimulator("LiftMerger.FindEntryById"))
                    {
                        sally.CheckinAndPullAndMerge(bob);
                    }
                    Assert.That(sally.ProgressString, Does.Contain("InduceChorusFailure"));

                    sally.AssertHeadCount(2);
                    //ok, Bob's the tip, but...
                    Assert.AreEqual("bob", sally.Repository.GetTip().UserId);
                    //make sure we didn't move up to that tip, because we weren't able to merge with it
                    var currentRevision = sally.GetRepository().GetRevisionWorkingSetIsBasedOn();
                    Assert.AreEqual("sally", sally.GetRepository().GetRevision(currentRevision.Number.Hash).UserId);
                    Assert.That(File.ReadAllText(sally.UserFile.Path), Does.Contain("sallyWasHere"));

                    //and over at Bob's house, it's as if Sally had never connected

                    bob.AssertHeadCount(1);
                    Assert.AreEqual("bob", bob.Repository.GetTip().UserId);
                    Assert.That(File.ReadAllText(bob.UserFile.Path), Does.Contain("bobWasHere"));
                }
            }
            File.Delete(Path.Combine(Path.GetTempPath(), "LiftMerger.FindEntryById"));
        }
        public void Sync_MergeWhenThereIsMoreThanOneHeadToMergeWith_MergesBoth()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    var tip = sally.Repository.GetTip();
                    sally.ReplaceSomething("forbranch1");
                    sally.AddAndCheckIn();
                    sally.Repository.Update(tip.Number.Hash);

                    sally.ReplaceSomething("forbranch1");
                    sally.AddAndCheckIn();
                    sally.Repository.Update(tip.Number.Hash);

                    sally.ReplaceSomething("forbranch2");
                    sally.AddAndCheckIn();
                    sally.Repository.Update(tip.Number.Hash);

                    sally.ReplaceSomething("forbranch3");
                    sally.AddAndCheckIn();
                    sally.Repository.Update(tip.Number.Hash);

                    sally.AssertHeadCount(4);

                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");
                    sally.CheckinAndPullAndMerge(bob);

                    sally.AssertNoErrorsReported();

                    var rescueFiles = Directory.GetFiles(sally.ProjectFolder.Path, "*.ChorusRescuedFile");
                    Assert.AreEqual(0, rescueFiles.Length);

                    sally.AssertHeadCount(1);
                }
        }