コード例 #1
0
        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"));
        }
コード例 #2
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);
				}
			}
		}
コード例 #3
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);
         }
     }
 }
コード例 #4
0
        public void AlreadyHaveProjectFiltersOutRepo()
        {
            // Setup
            var repo      = _sueRepo.GetRepository();
            var extantDir = Path.Combine(_tempDir.Path, "extantmatchingrepo");

            Directory.CreateDirectory(extantDir);
            repo.CloneLocalWithoutUpdate(extantDir);
            var sut = new ObtainProjectStrategyFlex();

            // Exercise/Verify
            Assert.IsTrue(sut.ProjectFilter(extantDir));
        }
コード例 #5
0
		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));
				}
			}
		}
コード例 #6
0
 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));
         }
     }
 }