예제 #1
0
        public void CreateBranchesTest()
        {
            // Setup
            using (var repoWithFiles = RepositoryWithFilesSetup.CreateWithLiftFile(stestUser))
            {
                repoWithFiles.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("default");
                var branchingHelper = repoWithFiles.Repository.BranchingHelper;
                Assert.AreEqual(1, branchingHelper.GetBranches().Count(),
                                "Setup problem in test, should be starting with one branch.");
                const string newBranchName = "FLEx70000059";
                var          oldversion    = branchingHelper.ClientVersion;

                // SUT
                branchingHelper.Branch(new ConsoleProgress(), newBranchName);
                repoWithFiles.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct(newBranchName);
                repoWithFiles.ReplaceSomething("nottheoriginal");
                repoWithFiles.SyncWithOptions(new SyncOptions
                {
                    DoPullFromOthers   = false,
                    CheckinDescription = "new local branch",
                    DoSendToOthers     = false
                });

                // Verification
                var revs = branchingHelper.GetBranches();
                Assert.AreEqual(2, revs.Count(), "Should be 2 branches now.");
                Assert.AreEqual(newBranchName, revs.First().Branch, "Should be a branch with this name.");
                var localRevNum = revs.First().Number.LocalRevisionNumber;
                var lastRev     = repoWithFiles.Repository.GetRevision(localRevNum);
                Assert.AreEqual(stestUser, lastRev.UserId, "User name should be set.");
                Assert.AreNotEqual(oldversion, branchingHelper.ClientVersion, "Should have updated ClientVersion");
            }
        }
예제 #2
0
        public void OurCommitOnlyFailsCommitCopCheck()
        {
            // 3. Backout after CommitCop bailout.
            //		UpdateToTheDescendantRevision repository.RollbackWorkingDirectoryToRevision(head.Number.LocalRevisionNumber); (line 570)
            //		Expected files to exist: CommitPathname, and RollbackPathname, but not PullPathname or MergePathname.
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
            {
                File.WriteAllText(bob.UserFile.Path, "New contents");

                var syncAdjunct = new FileWriterSychronizerAdjunct(bob.RootFolder.Path);
                CheckNoFilesExist(syncAdjunct);

                var options = new SyncOptions
                {
                    DoMergeWithOthers = false,
                    DoPullFromOthers  = false,
                    DoSendToOthers    = false
                };
                var synchronizer = bob.Synchronizer;
                synchronizer.SynchronizerAdjunct = syncAdjunct;

                var syncResults = bob.SyncWithOptions(options, synchronizer);
                Assert.That(syncResults.Cancelled, Is.False);
                Assert.That(syncResults.DidGetChangesFromOthers, Is.False);
                Assert.That(syncResults.Succeeded, Is.False);
                CheckExistanceOfAdjunctFiles(syncAdjunct, true, false, true, false, true, false);
            }
        }
예제 #3
0
        public void CanCreateVersionNumberBranch_BackwardCompatibilityTest()
        {
            // Setup (creates repo with default branch)
            using (var repoWithFiles = RepositoryWithFilesSetup.CreateWithLiftFile(stestUser))
            {
                var branchingHelper = repoWithFiles.Repository.BranchingHelper;
                Assert.AreEqual(1, branchingHelper.GetBranches().Count(),
                                "Setup problem in test, should be starting with one branch.");
                // Make a new branch with an integer name
                var integerBranchName = "70000068";
                repoWithFiles.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct(integerBranchName);
                repoWithFiles.ReplaceSomething("nottheoriginal");
                repoWithFiles.SyncWithOptions(new SyncOptions
                {
                    DoPullFromOthers   = false,
                    CheckinDescription = "version number branch",
                    DoSendToOthers     = false
                });

                var revisions = repoWithFiles.Repository.GetAllRevisions();
                var branches  = new HashSet <string>();
                foreach (var rev in revisions)
                {
                    branches.Add(rev.Branch);
                }
                Assert.AreEqual(branches.Count, 2, "Should be 2 branches, default and " + integerBranchName);
                CollectionAssert.Contains(branches, integerBranchName, "The integer branch name was not created.");
            }
        }
        public void Sync_WeHaveAFileWhichTheyAlsoEditedButHavenotCheckedIn_TheirsIsRenamedToSafetyAndTheyGetOurs()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    File.WriteAllText(bob.ProjectFolder.Combine("problem.txt"), "bob's problem");
                    //notice, we don't alter the include pattern on bob, so this doesn't get checked in
                    // on his side
                    bob.AddAndCheckIn();

                    sally.ReplaceSomething("sallyWasHere");
                    File.WriteAllText(sally.ProjectFolder.Combine("problem.txt"), "sally's problem");
                    sally.ProjectConfiguration.IncludePatterns.Add("problem.txt");

                    sally.CheckinAndPullAndMerge(bob);
                    sally.AssertNoErrorsReported();

                    //ok, so the problem is now lurking in bob's repo, but it doesn't hit him until
                    //he does at least an update

                    bob.CheckinAndPullAndMerge(sally);

                    var rescueFiles = Directory.GetFiles(bob.ProjectFolder.Path, "*.ChorusRescuedFile");
                    Assert.AreEqual(1, rescueFiles.Length);
                    Assert.AreEqual("bob's problem", File.ReadAllText(rescueFiles[0]));
                    sally.AssertFileContents("problem.txt", "sally's problem");
                }
            }
        }
예제 #5
0
 public void GetTip_AfterSyncing_GetTip()
 {
     using (var setup = new RepositoryWithFilesSetup("dontMatter", "foo.txt", ""))
     {
         Assert.AreEqual("0", setup.Repository.GetTip().Number.LocalRevisionNumber);
     }
 }
        public void Sync_BothChangedBinaryFile_FailureReportedOneChosenSingleHead()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    //now we have a merge of a file type that don't know how to merge
                    sally.CheckinAndPullAndMerge(bob);

                    sally.AssertSingleHead();
                    bob.AssertSingleHead();

                    //sally.AssertSingleConflict(c => c.GetType == typeof (UnmergableFileTypeConflict));
                    sally.AssertSingleConflictType <UnmergableFileTypeConflict>();

                    // nb: this is sally because the conflict handling mode is (at the time of this test
                    // writing) set to WeWin.
                    Assert.That(File.ReadAllText(sally.UserFile.Path), Does.Contain("sallyWasHere"));
                }
            }
        }
        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"));
        }
예제 #8
0
 public void AlreadyHaveProjectFiltersOutAttemptToCloneAgain()
 {
     using (var sueRepo = new RepositoryWithFilesSetup("SueForLift", "Sue.lift", "contents"))
     {
         var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
         Utilities.SetProjectsPathForTests(fakeProjectDir);
         try
         {
             using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
             {
                 var sue       = sueRepo.GetRepository();
                 var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo", Utilities.OtherRepositories, Utilities.LIFT);
                 Directory.CreateDirectory(extantDir);
                 Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
                 sue.CloneLocalWithoutUpdate(extantDir);
                 var strat = new LiftObtainProjectStrategy();
                 Assert.IsFalse(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
             }
         }
         finally
         {
             Utilities.SetProjectsPathForTests(null);
         }
     }
 }
예제 #9
0
 public void SendReceiveWithTrivialMergeCallsSimpleUpdate()
 {
     using (var alistair = RepositoryWithFilesSetup.CreateWithLiftFile("alistair"))
         using (var susanna = RepositoryWithFilesSetup.CreateByCloning("suzy", alistair))
         {
             var syncAdjunct = new FileWriterSychronizerAdjunct(susanna.RootFolder.Path);
             CheckNoFilesExist(syncAdjunct);
             var options = new SyncOptions
             {
                 DoMergeWithOthers = true,
                 DoPullFromOthers  = true,
                 DoSendToOthers    = true
             };
             var bobOptions = new SyncOptions
             {
                 DoMergeWithOthers      = true,
                 DoPullFromOthers       = true,
                 DoSendToOthers         = true,
                 RepositorySourcesToTry = { alistair.RepoPath }
             };
             var synchronizer = susanna.Synchronizer;
             synchronizer.SynchronizerAdjunct = syncAdjunct;
             alistair.ReplaceSomething("nice.");
             alistair.SyncWithOptions(options);
             susanna.ReplaceSomethingElse("no problems.");
             var syncResults = susanna.SyncWithOptions(bobOptions, synchronizer);
             Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
             CheckExistanceOfAdjunctFiles(syncAdjunct, true, true, false, true, true, true);
         }
 }
		public void AlreadyHaveProjectFiltersOutAttemptToCloneAgain()
		{
			using (var sueRepo = new RepositoryWithFilesSetup("SueForLift", "Sue.lift", "contents"))
			{
				var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
				Utilities.SetProjectsPathForTests(fakeProjectDir);
				try
				{
					using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
					{
						var sue = sueRepo.GetRepository();
						var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo", Utilities.OtherRepositories, Utilities.LIFT);
						Directory.CreateDirectory(extantDir);
						Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
						sue.CloneLocalWithoutUpdate(extantDir);
						var strat = new LiftObtainProjectStrategy();
						Assert.IsFalse(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
					}
				}
				finally
				{
					Utilities.SetProjectsPathForTests(null);
				}
			}
		}
예제 #11
0
        public void EachOneChangedOrAddedFileButNotSameFile_HasCommitAndPullAndMergeFilesOnly()
        {
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();

                    sally.ProjectConfiguration.IncludePatterns.Add("sally.txt");

                    var newFileForSally = TempFile.WithFilename(Path.Combine(sally.ProjectFolder.Path, "sally.txt"));
                    File.WriteAllText(newFileForSally.Path, "Sally's new text.");

                    var syncAdjunct = new FileWriterSychronizerAdjunct(sally.RootFolder.Path);
                    CheckNoFilesExist(syncAdjunct);

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;
                    synchronizer.SynchronizerAdjunct = syncAdjunct;

                    var syncResults = sally.SyncWithOptions(options, synchronizer);
                    Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
                    CheckExistanceOfAdjunctFiles(syncAdjunct, true, true, false, true, true, true);
                }
        }
예제 #12
0
        public void CommitWithMergeHasCommitFileAndMergeFile()
        {
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    var syncAdjunct = new FileWriterSychronizerAdjunct(sally.RootFolder.Path);
                    CheckNoFilesExist(syncAdjunct);

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;
                    synchronizer.SynchronizerAdjunct = syncAdjunct;

                    var syncResults = sally.SyncWithOptions(options, synchronizer);
                    Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
                    CheckExistanceOfAdjunctFiles(syncAdjunct, true, true, false, true, true, true);
                }
        }
예제 #13
0
        public void TheyMadeChanges_WeDidNothing_Fires_SimpleUpdate_WithFalse()
        {
            // 1. Simple pull got new stuff, while we changed nothing
            //		UpdateToTheDescendantRevision repository.Update(); //update to the tip (line 556)
            //		Expected files to exist: CommitPathname and PullPathname, but not RollbackPathname or MergePathname.
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();

                    var syncAdjunct = new FileWriterSychronizerAdjunct(sally.RootFolder.Path);
                    CheckNoFilesExist(syncAdjunct);

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;
                    synchronizer.SynchronizerAdjunct = syncAdjunct;

                    var syncResults = sally.SyncWithOptions(options, synchronizer);
                    Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
                    CheckExistanceOfAdjunctFiles(syncAdjunct, true, true, false, false, true, true);
                }
        }
예제 #14
0
        public void BothMadeChanges_MergeFailure_Fires_SimpleUpdate_WithTrue()
        {
            // 2. Rollback on merge failure, when we changed stuff.
            //		UpdateToTheDescendantRevision repository.RollbackWorkingDirectoryToRevision(head.Number.LocalRevisionNumber); (line 570)
            //		Expected files to exist: CommitPathname and RollbackPathname, but not PullPathname or MergePathname.
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    var syncAdjunct = new FileWriterSychronizerAdjunct(sally.RootFolder.Path);
                    CheckNoFilesExist(syncAdjunct);

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;
                    synchronizer.SynchronizerAdjunct = syncAdjunct;

                    using (new FailureSimulator("SychronizerAdjunct"))
                    {
                        var syncResults = sally.SyncWithOptions(options, synchronizer);
                        Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
                        Assert.That(syncResults.Cancelled, Is.False);
                        Assert.That(syncResults.Succeeded, Is.False);
                        CheckExistanceOfAdjunctFiles(syncAdjunct, true, false, true, false, true, false);
                    }
                }
        }
예제 #15
0
        public void CheckBranchesGetsRightNumberOfBranches()
        {
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("NOTDEFAULT");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    var syncAdjunct = new FileWriterSychronizerAdjunct(sally.RootFolder.Path);

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;
                    synchronizer.SynchronizerAdjunct = syncAdjunct;

                    var syncResults = sally.SyncWithOptions(options, synchronizer);
                    Assert.That(syncResults.DidGetChangesFromOthers, Is.True);
                    CheckExistanceOfAdjunctFiles(syncAdjunct, true, true, false, false, true, true);
                    var lines = File.ReadAllLines(syncAdjunct.CheckRepoBranchesPathName);
                    Assert.AreEqual(lines.Length, 2, "Wrong number of branches on CheckBranches call");
                }
        }
예제 #16
0
 public void GetTip_AfterSyncing_GetTip()
 {
     using (var setup = new RepositoryWithFilesSetup("dontMatter", "foo.txt", ""))
     {
         Assert.AreEqual("0", setup.Repository.GetTip().Number.LocalRevisionNumber);
     }
 }
        public void Sync_RepeatedMergeFailure_WeAreLeftOnOurOwnWorkingDefault()
        {
            using (var bob = new RepositoryWithFilesSetup("bob", "test.txt", "hello"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                    using (new FailureSimulator("TextMerger-test.txt"))
                    {
                        bob.WriteNewContentsToTestFile("bobWasHere");
                        bob.AddAndCheckIn();
                        sally.WriteNewContentsToTestFile("sallyWasHere");
                        var result = sally.CheckinAndPullAndMerge(bob);
                        Assert.That(result.Succeeded, Is.False);

                        //make sure we ended up on Sally's revision, even though Bob's are newer
                        var currentRevision = sally.Repository.GetRevisionWorkingSetIsBasedOn();
                        Assert.AreEqual("sally", sally.Repository.GetRevision(currentRevision.Number.Hash).UserId);

                        //Now do it again

                        bob.WriteNewContentsToTestFile("bobWasHere2");
                        bob.AddAndCheckIn();
                        Assert.AreEqual("bob", sally.Repository.GetTip().UserId, "if bob's not the tip, we're not testing the right situation");

                        result = sally.CheckinAndPullAndMerge(bob);
                        Assert.That(result.Succeeded, Is.False);
                        result = sally.CheckinAndPullAndMerge(bob);

                        Assert.AreEqual("sally", sally.Repository.GetRevisionWorkingSetIsBasedOn().UserId);


                        //sally.ShowInTortoise();
                    }
            File.Delete(Path.Combine(Path.GetTempPath(), "TextMerger-test.txt"));
        }
        public void Setup()
        {
            // The contents of the properties file that we create here doesn't really matter
            // for these tests, so we simply pass bogus content
            _sueRepo = new RepositoryWithFilesSetup("Sue",
                                                    SharedConstants.CustomPropertiesFilename, "contents");

            _tempDir = new TemporaryFolder(Guid.NewGuid().ToString());
        }
		public void Setup()
		{
			// The contents of the properties file that we create here doesn't really matter
			// for these tests, so we simply pass bogus content
			_sueRepo = new RepositoryWithFilesSetup("Sue",
				SharedConstants.CustomPropertiesFilename, "contents");

			_tempDir = new TemporaryFolder(Guid.NewGuid().ToString());
		}
        public void Sync_NewFileWithNonAsciCharacters_FileAdded()
        {
            string name = "ŭburux.txt";

            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", name, "original"))
            {
                bob.AddAndCheckIn();
                bob.AssertNoErrorsReported();
            }
        }
예제 #21
0
        public void GetBranchesTest()
        {
            // Setup
            using (var repoWithFiles = RepositoryWithFilesSetup.CreateWithLiftFile(stestUser))
            {
                var branchingHelper = repoWithFiles.Repository.BranchingHelper;

                // SUT
                var result = branchingHelper.GetBranches();

                // Verification
                Assert.AreEqual(1, result.Count());
            }
        }
 public void Sync_MergeTimeoutExceeded_LeavesNoChorusMergeProcessAlive()
 {
     HgRunner.TimeoutSecondsOverrideForUnitTests = 1;
     using (var fred = RepositoryWithFilesSetup.CreateWithLiftFile("fred"))
     {
         using (var betty = RepositoryWithFilesSetup.CreateByCloning("betty", fred))
         {
             fred.ReplaceSomething("fredWasHere");
             fred.AddAndCheckIn();
             betty.ReplaceSomething("bettyWasHere");
             betty.CheckinAndPullAndMerge(fred);
             Assert.AreEqual(0, Process.GetProcessesByName("ChorusMerge").Length);
         }
     }
 }
		public void DoNotHaveProjectDoesNotFilterOutRepo()
		{
			using (var sueRepo = new RepositoryWithFilesSetup("Sue", SharedConstants.CustomPropertiesFilename, "contents"))
			{
				var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
				Directory.CreateDirectory(fakeProjectDir);
				using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
				{
					var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo");
					Directory.CreateDirectory(extantDir);
					Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
					var strat = new ObtainProjectStrategyFlex();
					Assert.IsTrue(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
				}
			}
		}
 public void DoNotHaveProjectDoesNotFilterOutRepo()
 {
     using (var sueRepo = new RepositoryWithFilesSetup("Sue", SharedConstants.CustomPropertiesFilename, "contents"))
     {
         var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
         Directory.CreateDirectory(fakeProjectDir);
         using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
         {
             var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo");
             Directory.CreateDirectory(extantDir);
             Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
             var strat = new ObtainProjectStrategyFlex();
             Assert.IsTrue(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
         }
     }
 }
		public void AlreadyHaveProjectFiltersOutAttemptToCloneAgain()
		{
			using (var sueRepo = new RepositoryWithFilesSetup("Sue", SharedConstants.CustomPropertiesFilename, "contents"))
			{
				var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
				using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
				{
					var sue = sueRepo.GetRepository();
					var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo");
					Directory.CreateDirectory(extantDir);
					Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
					sue.CloneLocalWithoutUpdate(extantDir);
					var strat = new ObtainProjectStrategyFlex();
					Assert.IsFalse(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
				}
			}
		}
		public void DoNotHaveProjectDoesNotFilterOutRepo()
		{
			using (var sueRepo = new RepositoryWithFilesSetup("SueForLift", "Sue.lift", "contents"))
			{
				var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
				Directory.CreateDirectory(fakeProjectDir);
				using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
				{
					var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo", Utilities.OtherRepositories, Utilities.LIFT);
					Directory.CreateDirectory(extantDir);
					Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepowithoffset", Utilities.OtherRepositories, Utilities.LIFT));
					Directory.CreateDirectory(Path.Combine(fakeProjectDir, "noreposansoffset"));
					var strat = new ObtainProjectStrategyLift();
					Assert.IsTrue(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
				}
			}
		}
 public void AlreadyHaveProjectFiltersOutAttemptToCloneAgain()
 {
     using (var sueRepo = new RepositoryWithFilesSetup("Sue", SharedConstants.CustomPropertiesFilename, "contents"))
     {
         var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
         using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
         {
             var sue       = sueRepo.GetRepository();
             var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo");
             Directory.CreateDirectory(extantDir);
             Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepo"));
             sue.CloneLocalWithoutUpdate(extantDir);
             var strat = new ObtainProjectStrategyFlex();
             Assert.IsFalse(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
         }
     }
 }
 public void DoNotHaveProjectDoesNotFilterOutRepo()
 {
     using (var sueRepo = new RepositoryWithFilesSetup("SueForLift", "Sue.lift", "contents"))
     {
         var fakeProjectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
         Directory.CreateDirectory(fakeProjectDir);
         using (var tempDir = TemporaryFolder.TrackExisting(fakeProjectDir))
         {
             var extantDir = Path.Combine(fakeProjectDir, "extantmatchingrepo", Utilities.OtherRepositories, Utilities.LIFT);
             Directory.CreateDirectory(extantDir);
             Directory.CreateDirectory(Path.Combine(fakeProjectDir, "norepowithoffset", Utilities.OtherRepositories, Utilities.LIFT));
             Directory.CreateDirectory(Path.Combine(fakeProjectDir, "noreposansoffset"));
             var strat = new ObtainProjectStrategyLift();
             Assert.IsTrue(strat.ProjectFilter(sueRepo.ProjectFolder.Path));
         }
     }
 }
 public void Sync_MergeFailure_LeavesNoChorusMergeProcessAlive()
 {
     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.AreEqual(0, Process.GetProcessesByName("ChorusMerge").Length);
         }
     }
     File.Delete(Path.Combine(Path.GetTempPath(), "LiftMerger.FindEntryById"));
 }
예제 #30
0
        public void ConflictFileIsCheckedIn()
        {
            using (RepositoryWithFilesSetup bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bob");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sally");
                    sally.CheckinAndPullAndMerge(bob);

                    string notesFile = ChorusNotesMergeEventListener.GetChorusNotesFilePath(sally.UserFile.Path);
                    Console.WriteLine("notesFile '{0}'", notesFile);
                    Assert.That(notesFile, Does.Exist, "Conflict file should have been in working set");
                    Assert.That(sally.Synchronizer.Repository.GetFileIsInRepositoryFromFullPath(notesFile), Is.True, "Notes file should have been added to repository");
                }
            }
        }
예제 #31
0
 public void SendReceiveWithNoRemoteChangesGetsNoFiles()
 {
     using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
     {
         var syncAdjunct = new FileWriterSychronizerAdjunct(bob.RootFolder.Path);
         CheckNoFilesExist(syncAdjunct);
         var options = new SyncOptions
         {
             DoMergeWithOthers = true,
             DoPullFromOthers  = true,
             DoSendToOthers    = true
         };
         var synchronizer = bob.Synchronizer;
         synchronizer.SynchronizerAdjunct = syncAdjunct;
         var syncResults = bob.SyncWithOptions(options, synchronizer);
         Assert.That(syncResults.DidGetChangesFromOthers, Is.False);
         CheckExistanceOfAdjunctFiles(syncAdjunct, true, false, false, false, true, true);
     }
 }
예제 #32
0
        public void DoesNewBranchExist_No()
        {
            // Setup
            using (var repoWithFiles = RepositoryWithFilesSetup.CreateWithLiftFile(stestUser))
            {
                var branchingHelper = repoWithFiles.Repository.BranchingHelper;
                Assert.AreEqual(1, branchingHelper.GetBranches().Count(),
                                "Setup problem in test, should be starting with one branch.");

                const string myVersion = "";                 // Equivalent to 'default'

                // SUT
                string revNum;
                bool   result = branchingHelper.IsLatestBranchDifferent(myVersion, out revNum);

                // Verification
                Assert.IsFalse(result, "The only branch should be default.");
            }
        }
        public void Sync_WeHaveUntrackedFile_NotRenamed()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    File.WriteAllText(bob.ProjectFolder.Combine("somethingNew.txt"), "blah");
                    bob.ProjectConfiguration.IncludePatterns.Add("somethingNew.txt");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");
                    File.WriteAllText(sally.ProjectFolder.Combine("untracked.txt"), "foo");
                    sally.CheckinAndPullAndMerge(bob);

                    sally.AssertNoErrorsReported();

                    var rescueFiles = Directory.GetFiles(sally.ProjectFolder.Path, "*.ChorusRescuedFile");
                    Assert.AreEqual(0, rescueFiles.Length);
                }
            }
        }
예제 #34
0
        public void CommitWithMergeDoesNotThrowWithDefaultSychronizerAdjunct()
        {
            using (var bob = RepositoryWithFilesSetup.CreateWithLiftFile("bob"))
                using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    var options = new SyncOptions
                    {
                        DoMergeWithOthers = true,
                        DoPullFromOthers  = true,
                        DoSendToOthers    = true
                    };
                    options.RepositorySourcesToTry.Add(bob.RepoPath);
                    var synchronizer = sally.Synchronizer;

                    Assert.DoesNotThrow(() => sally.SyncWithOptions(options, synchronizer));
                }
        }
예제 #35
0
        public void DoesNewBranchExist_Yes()
        {
            // Setup
            using (var repoWithFiles = RepositoryWithFilesSetup.CreateWithLiftFile(stestUser))
            {
                repoWithFiles.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("default");
                var branchingHelper = repoWithFiles.Repository.BranchingHelper;
                Assert.AreEqual(1, branchingHelper.GetBranches().Count(),
                                "Setup problem in test, should be starting with one branch.");
                // Make a new branch (should technically be on the remote with a different user...)
                const string newBranchName = "New Branch";
                branchingHelper.Branch(new NullProgress(), newBranchName);
                repoWithFiles.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct(newBranchName);
                repoWithFiles.ReplaceSomething("nottheoriginal");
                repoWithFiles.SyncWithOptions(new SyncOptions
                {
                    DoPullFromOthers   = false,
                    CheckinDescription = "new local branch",
                    DoSendToOthers     = false
                });

                const string myVersion = "";                 // Hg default branch name

                // SUT
                string revNum;
                bool   result = branchingHelper.IsLatestBranchDifferent(myVersion, out revNum);

                // Verification
                Assert.IsTrue(result, "The only branch should be default.");
                var revision = repoWithFiles.Repository.GetRevision(revNum);
                Assert.AreEqual(newBranchName, revision.Branch, "Wrong branch name in new branch.");
                var revisions = repoWithFiles.Repository.GetAllRevisions();
                var branches  = new HashSet <string>();
                foreach (var rev in revisions)
                {
                    branches.Add(rev.Branch);
                }
                Assert.AreEqual(branches.Count, 2, "Branches not properly reported in revisions.");
            }
        }
        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);
                }
        }
        public void Sync_RepeatedMergeFailure_WeAreLeftOnOurOwnWorkingDefault()
        {
            using (var bob = new RepositoryWithFilesSetup("bob", "test.txt", "hello"))
            using (var sally = RepositoryWithFilesSetup.CreateByCloning("sally",bob))
            using (new FailureSimulator("TextMerger-test.txt"))
            {
                bob.WriteNewContentsToTestFile("bobWasHere");
                bob.AddAndCheckIn();
                sally.WriteNewContentsToTestFile("sallyWasHere");
                var result = sally.CheckinAndPullAndMerge(bob);
                Assert.IsFalse(result.Succeeded);

                //make sure we ended up on Sally's revision, even though Bob's are newer
                var currentRevision = sally.Repository.GetRevisionWorkingSetIsBasedOn();
                Assert.AreEqual("sally", sally.Repository.GetRevision(currentRevision.Number.Hash).UserId);

                //Now do it again

                bob.WriteNewContentsToTestFile("bobWasHere2");
                bob.AddAndCheckIn();
                Assert.AreEqual("bob", sally.Repository.GetTip().UserId,"if bob's not the tip, we're not testing the right situation");
                
                result = sally.CheckinAndPullAndMerge(bob);
                Assert.IsFalse(result.Succeeded);
                result = sally.CheckinAndPullAndMerge(bob);
   
                Assert.AreEqual("sally",sally.Repository.GetRevisionWorkingSetIsBasedOn().UserId);
                

                //sally.ShowInTortoise();

			}
			File.Delete(Path.Combine(Path.GetTempPath(), "TextMerger-test.txt"));
        }
        public void Sync_BothChangedBinaryFile_FailureReportedOneChosenSingleHead()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    bob.ReplaceSomething("bobWasHere");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");

                    //now we have a merge of a file type that don't know how to merge
                    sally.CheckinAndPullAndMerge(bob);

                    sally.AssertSingleHead();
                    bob.AssertSingleHead();

                    //sally.AssertSingleConflict(c => c.GetType == typeof (UnmergableFileTypeConflict));
                    sally.AssertSingleConflictType<UnmergableFileTypeConflict>();

                    // nb: this is sally because the conflict handling mode is (at the time of this test
                    // writing) set to WeWin.
					Assert.IsTrue(File.ReadAllText(sally.UserFile.Path).Contains("sallyWasHere"));
                }

            }
        }
        public void Sync_WeHaveUntrackedFile_NotRenamed()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    File.WriteAllText(bob.ProjectFolder.Combine("somethingNew.txt"), "blah");
                    bob.ProjectConfiguration.IncludePatterns.Add("somethingNew.txt");
                    bob.AddAndCheckIn();
                    sally.ReplaceSomething("sallyWasHere");
                    File.WriteAllText(sally.ProjectFolder.Combine("untracked.txt"), "foo");
                    sally.CheckinAndPullAndMerge(bob);

                    sally.AssertNoErrorsReported();

                    var rescueFiles = Directory.GetFiles(sally.ProjectFolder.Path, "*.ChorusRescuedFile");
                    Assert.AreEqual(0, rescueFiles.Length);
                }
            }
        }
        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);
            }

        }
        public void Sync_WeHaveAFileWhichTheyAlsoEditedButHavenotCheckedIn_TheirsIsRenamedToSafetyAndTheyGetOurs()
        {
            using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", "test.a9a", "original"))
            {
                using (RepositoryWithFilesSetup sally = RepositoryWithFilesSetup.CreateByCloning("sally", bob))
                {
                    File.WriteAllText(bob.ProjectFolder.Combine("problem.txt"), "bob's problem");
                    //notice, we don't alter the include pattern on bob, so this doesn't get checked in 
                    // on his side
                    bob.AddAndCheckIn();

                    sally.ReplaceSomething("sallyWasHere");
                    File.WriteAllText(sally.ProjectFolder.Combine("problem.txt"), "sally's problem");
                    sally.ProjectConfiguration.IncludePatterns.Add("problem.txt");

                    sally.CheckinAndPullAndMerge(bob);
                    sally.AssertNoErrorsReported();

                    //ok, so the problem is now lurking in bob's repo, but it doesn't hit him until
                    //he does at least an update
                    
                    bob.CheckinAndPullAndMerge(sally);

                    var rescueFiles = Directory.GetFiles(bob.ProjectFolder.Path, "*.ChorusRescuedFile");
                    Assert.AreEqual(1, rescueFiles.Length);
                    Assert.AreEqual("bob's problem", File.ReadAllText(rescueFiles[0]));
                    sally.AssertFileContents("problem.txt", "sally's problem");
                }

            }
        }
 public void Sync_NewFileWithNonAsciCharacters_FileAdded()
 {
     string name = "ŭburux.txt";
     using (RepositoryWithFilesSetup bob = new RepositoryWithFilesSetup("bob", name, "original"))
     {
                bob.AddAndCheckIn();
                bob.AssertNoErrorsReported();
     }
 }
예제 #43
0
		[Category("UnknownMonoIssue")] // It insists on failing on mono, for some reason.
		public void EnsureRightPersonMadeChanges()
		{
			const string commonAncestor =
@"<?xml version='1.0' encoding='utf-8'?>
<Lexicon>
	<header>
		<LexDb guid='2d23f428-83a9-44ba-90f1-9e3264b5b982' >
			<DateCreated val='2012-12-10 6:29:17.117' />
			<DateModified val='2012-12-10 6:29:17.117' />
			<IsHeadwordCitationForm val='True' />
			<IsBodyInSeparateSubentry val='True' />
		</LexDb>
	</header>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<DateCreated val='2012-12-10 6:29:17.117' />
		<DateModified val='2012-12-10 6:29:17.117' />
		<HomographNumber val='1' />
		<DoNotUseForParsing val='True' />
		<ExcludeAsHeadword val='True' />
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='qaa-x-ezpi'>
						<Run
							ws='qaa-x-ezpi'>saklo, yzaklo, rzaklo, wzaklo, nzaklo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Lexicon>";
			const string sue =
@"<?xml version='1.0' encoding='utf-8'?>
<Lexicon>
	<header>
		<LexDb guid='2d23f428-83a9-44ba-90f1-9e3264b5b982' >
			<DateCreated val='2012-12-10 6:29:17.117' />
			<DateModified val='2012-12-10 6:29:17.117' />
			<IsHeadwordCitationForm val='True' />
			<IsBodyInSeparateSubentry val='True' />
		</LexDb>
	</header>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<DateCreated val='2012-12-10 6:29:17.117' />
		<DateModified val='2012-12-10 6:29:17.117' />
		<HomographNumber val='1' />
		<DoNotUseForParsing val='True' />
		<ExcludeAsHeadword val='True' />
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='qaa-x-ezpi'>
						<Run
							ws='qaa-x-ezpi'>saglo, yzaglo, rzaglo, wzaglo, nzaglo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Lexicon>";
			const string randy =
@"<?xml version='1.0' encoding='utf-8'?>
<Lexicon>
	<header>
		<LexDb guid='2d23f428-83a9-44ba-90f1-9e3264b5b982' >
		</LexDb>
	</header>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='zpi'>
						<Run
							ws='zpi'>saklo, yzaklo, rzaklo, wzaklo, nzaklo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Lexicon>";

			const string customPropData =
@"<?xml version='1.0' encoding='utf-8'?>
<AdditionalFields>
	<CustomField
		class='LexEntry'
		destclass='7'
		key='LexEntryTone'
		listRoot='53241fd4-72ae-4082-af55-6b659657083c'
		name='Tone'
		type='ReferenceCollection' />
	<CustomField
		class='LexSense'
		key='LexSenseParadigm'
		name='Paradigm'
		type='MultiString'
		wsSelector='-2' />
	<CustomField
		class='WfiWordform'
		key='WfiWordformCertified'
		name='Certified'
		type='Boolean' />
</AdditionalFields>";

			var mdc = MetadataCache.TestOnlyNewCache;
			using (var sueRepo = new RepositoryWithFilesSetup("Sue", string.Format("{0}_01.{1}", SharedConstants.Lexicon, SharedConstants.Lexdb), commonAncestor))
			{
				var sueProjPath = sueRepo.ProjectFolder.Path;
				// Add model version number file.
				var modelVersionPathname = Path.Combine(sueProjPath, SharedConstants.ModelVersionFilename);
				File.WriteAllText(modelVersionPathname, AnnotationImages.kModelVersion);
				sueRepo.Repository.TestOnlyAddSansCommit(modelVersionPathname);
				// Add custom property data file.
				var customPropsPathname = Path.Combine(sueProjPath, SharedConstants.CustomPropertiesFilename);
				File.WriteAllText(customPropsPathname, customPropData);
				sueRepo.Repository.TestOnlyAddSansCommit(customPropsPathname);
				sueRepo.AddAndCheckIn();

				using (var randyRepo = RepositoryWithFilesSetup.CreateByCloning("Randy", sueRepo))
				{
					// By doing the clone first, we get the common starting state in both repos.
					sueRepo.WriteNewContentsToTestFile(sue);
					sueRepo.AddAndCheckIn();

					var mergeConflictsNotesFile = ChorusNotesMergeEventListener.GetChorusNotesFilePath(randyRepo.UserFile.Path);
					Assert.IsFalse(File.Exists(mergeConflictsNotesFile), "ChorusNotes file should NOT have been in working set.");
					randyRepo.WriteNewContentsToTestFile(randy);
					randyRepo.CheckinAndPullAndMerge(sueRepo);
					Assert.IsTrue(File.Exists(mergeConflictsNotesFile), "ChorusNotes file should have been in working set.");
					var notesContents = File.ReadAllText(mergeConflictsNotesFile);
					Assert.IsNotNullOrEmpty(notesContents);
					Assert.IsTrue(notesContents.Contains("Removed Vs Edited Element Conflict"));
					Assert.IsTrue(notesContents.Contains("Randy deleted this element"));
					Assert.IsTrue(notesContents.Contains("Sue edited it"));
					Assert.IsTrue(notesContents.Contains("The merger kept the change made by Sue."));
					Assert.IsTrue(notesContents.Contains("whoWon=\"Sue\""));
					Assert.IsTrue(notesContents.Contains("alphaUserId=\"Randy\""));
					Assert.IsTrue(notesContents.Contains("betaUserId=\"Sue\""));

					// Make sure merged file has both alts.
					var doc = XDocument.Load(randyRepo.UserFile.Path);
					var customParadigmElement = doc.Root.Element("LexEntry").Element("Senses").Element("ownseq").Element("Custom");
					var aStrElements = customParadigmElement.Elements("AStr").ToList();
					Assert.AreEqual(2, aStrElements.Count);
					var aStrZpi = aStrElements.FirstOrDefault(el => el.Attribute("ws").Value == "zpi");
					Assert.IsNotNull(aStrZpi);
					Assert.IsTrue(aStrZpi.Element("Run").Value == "saklo, yzaklo, rzaklo, wzaklo, nzaklo, -");
					var aStrEzpi = aStrElements.FirstOrDefault(el => el.Attribute("ws").Value == "qaa-x-ezpi");
					Assert.IsNotNull(aStrEzpi);
					Assert.IsTrue(aStrEzpi.Element("Run").Value == "saglo, yzaglo, rzaglo, wzaglo, nzaglo, -");
				}
			}
		}