Пример #1
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);
     }
 }
Пример #2
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.");
            }
        }
Пример #3
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));
                }
        }
Пример #4
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.");
            }
        }