Esempio n. 1
0
        public void StartsWithMappingsTest()
        {
            MigrationItemStrings fileOutSideMapping = new MigrationItemStrings("source-integration/file.txt", null, TestEnvironment, true);
            MigrationItemStrings fileUnderMapping   = new MigrationItemStrings("source/file.txt", null, TestEnvironment, true);

            TestUtils.CreateRandomFile(fileOutSideMapping.LocalPath, 10);
            TestUtils.CreateRandomFile(fileUnderMapping.LocalPath, 10);

            string mergeComment = "Migration test merge";

            SourceWorkspace.PendAdd(fileOutSideMapping.LocalPath);
            SourceWorkspace.PendAdd(fileUnderMapping.LocalPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), mergeComment);

            MappingPair mapping = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source",
                                                  TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source",
                                                  false);
            MappingPair mapping2 = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source-integration",
                                                   TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source-integration",
                                                   false);

            TestEnvironment.Mappings.Clear();

            TestEnvironment.AddMapping(mapping);
            TestEnvironment.AddMapping(mapping2);
            RunAndValidate();
        }
Esempio n. 2
0
        public void ThreeWayCyclicRenameTest()
        {
            MigrationItemStrings folder1 = new MigrationItemStrings("folder1/", null, TestEnvironment, true);
            MigrationItemStrings folder2 = new MigrationItemStrings("folder2/", null, TestEnvironment, true);
            MigrationItemStrings folder3 = new MigrationItemStrings("folder3/", null, TestEnvironment, true);
            MigrationItemStrings temp    = new MigrationItemStrings("temp/", null, TestEnvironment, true);

            MigrationItemStrings file1 = new MigrationItemStrings("folder1/file1.txt", null, TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings("folder2/file2.txt", null, TestEnvironment, true);
            MigrationItemStrings file3 = new MigrationItemStrings("folder3/file3.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(folder1.LocalPath);
            SourceAdapter.AddFolder(folder2.LocalPath);
            SourceAdapter.AddFolder(folder3.LocalPath);
            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFile(file3.LocalPath);

            // Create a cyclic rename of the three folders
            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(folder3.ServerPath, temp.ServerPath);
            SourceWorkspace.PendRename(folder2.ServerPath, folder3.ServerPath);
            SourceWorkspace.PendRename(folder1.ServerPath, folder2.ServerPath);
            SourceWorkspace.PendRename(temp.ServerPath, folder1.ServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);

            RunAndValidate();
        }
Esempio n. 3
0
        protected void BranchCyclicalRenameTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);

            MigrationItemStrings folder1 = new MigrationItemStrings("source/folder1/", null, TestEnvironment, true);
            MigrationItemStrings folder2 = new MigrationItemStrings("source/folder2/", null, TestEnvironment, true);
            MigrationItemStrings temp    = new MigrationItemStrings("source/temp/", null, TestEnvironment, true);

            MigrationItemStrings file1 = new MigrationItemStrings("source/folder1/file1.txt", null, TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings("source/folder2/file2.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(folder1.LocalPath);
            SourceAdapter.AddFolder(folder2.LocalPath);

            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceAdapter.EditFile(m_extraFile.LocalPath);

            SourceWorkspace.PendRename(folder1.ServerPath, temp.ServerPath);
            SourceWorkspace.PendRename(folder2.ServerPath, folder1.ServerPath);
            SourceWorkspace.PendRename(temp.ServerPath, folder2.ServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);

            SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath);

            RunAndValidate();
        }
Esempio n. 4
0
        public void MergeMovesTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("source/file.txt", "source/sub/file.txt", TestEnvironment, true);
            MigrationItemStrings file2  = new MigrationItemStrings("source/file2.txt", "source/sub/file2.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath);

            SourceAdapter.EditFile(file.LocalPath);
            SourceAdapter.EditFile(file.LocalPath);
            SourceAdapter.EditFile(m_extraFile.LocalPath);

            SourceAdapter.RenameItem(file.ServerPath, file.NewServerPath);
            SourceAdapter.RenameItem(file2.ServerPath, file2.NewServerPath);

            SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath,
                                  VersionSpec.ParseSingleSpec(branchChangeset.ToString(),
                                                              Environment.UserName), VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);
            ResolveConflicts(Resolution.AcceptTheirs);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            RunAndValidate();
        }
Esempio n. 5
0
        /// <summary>
        /// Perform a merge specifying the start and end changeset
        /// </summary>
        /// <param name="branch">The source server pah is the server namd the target path is the NewServerPath</param>
        /// <param name="mergeFrom">changeset to start merge from</param>
        /// <param name="mergeTo">changeset to merge up to</param>
        private void MergeTfsItem(MigrationItemStrings branch, int mergeFrom, int mergeTo)
        {
            string mergeComment = "Migration test merge";

            SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath,
                                  VersionSpec.ParseSingleSpec(mergeFrom.ToString(), Environment.UserName),
                                  VersionSpec.ParseSingleSpec(mergeTo.ToString(), Environment.UserName), LockLevel.None, RecursionType.Full, MergeOptions.None);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), mergeComment);
        }
Esempio n. 6
0
        private void CheckinMergeResolve(int changesetId)
        {
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MultiActionComment);

            SourceWorkspace.Merge(source.LocalPath, target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(),
                                                              Environment.UserName), VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            resolveConflictAcceptThiers();
        }
Esempio n. 7
0
        public void MergeTwoCyclicRenamesTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);

            MigrationItemStrings folder1 = new MigrationItemStrings("source/folder1/", null, TestEnvironment, true);
            MigrationItemStrings folder2 = new MigrationItemStrings("source/folder2/", null, TestEnvironment, true);
            MigrationItemStrings folder3 = new MigrationItemStrings("source/folder3/", null, TestEnvironment, true);
            MigrationItemStrings temp    = new MigrationItemStrings("source/temp/", null, TestEnvironment, true);

            MigrationItemStrings file1    = new MigrationItemStrings("source/folder1/file1.txt", null, TestEnvironment, true);
            MigrationItemStrings file2    = new MigrationItemStrings("source/folder1/file2.txt", null, TestEnvironment, true);
            MigrationItemStrings tempFile = new MigrationItemStrings("source/folder1/tempFile.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(folder1.LocalPath);
            SourceAdapter.AddFolder(folder2.LocalPath);
            SourceAdapter.AddFolder(folder3.LocalPath);

            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            int branchChangeset = SourceAdapter.BranchItem(branch);

            // Create a cyclic rename of two files
            SourceWorkspace.PendRename(file1.ServerPath, tempFile.ServerPath);
            SourceWorkspace.PendRename(file2.ServerPath, file1.ServerPath);
            SourceWorkspace.PendRename(tempFile.ServerPath, file2.ServerPath);

            // Create a three-way cyclic rename of the parent folder with two other folders
            SourceWorkspace.PendRename(folder1.ServerPath, temp.ServerPath);
            SourceWorkspace.PendRename(folder2.ServerPath, folder1.ServerPath);
            SourceWorkspace.PendRename(folder3.ServerPath, folder2.ServerPath);
            SourceWorkspace.PendRename(temp.ServerPath, folder3.ServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);

            SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath,
                                  VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.AlwaysAcceptMine);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            Run();

            if (TestEnvironment.SourceEndPoint.AdapterType == AdapterType.TFS2008VC)
            {
                VerifyHistory(0, 0);
                // For orcas, there should be no difference.
            }
            else
            {
                VerifyHistory(1, 1);
                // Need more comparison here.
                // On dev 10 server, rename becomes sourceDelete+targetbranch. So the rename-from-name will exist in the original place as a deleted item.
                // The merge will then merge the item as a Merge|Delete. We will skip the change in this case.
            }
        }
Esempio n. 8
0
        private void PendMergeUndelete(MigrationItemStrings item, int changesetId)
        {
            MergeDeletePendUndelete(item, changesetId);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MultiActionComment);

            SourceWorkspace.Merge(m_source.LocalPath, m_target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            resolveConflictAcceptThiers();
        }
Esempio n. 9
0
        public void AddSourceRename()
        {
            MigrationItemStrings file = new MigrationItemStrings("file.txt", "file-renamed.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            SourceWorkspace.Get();
            SourceWorkspace.PendRename(file.ServerPath, file.NewServerPath);
            TestUtils.CreateRandomFile(file.LocalPath, 10);
            SourceWorkspace.PendAdd(file.LocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "AddSourceRename");
            RunAndValidate();
        }
Esempio n. 10
0
        protected void RenameParentDeleteChildScenario(bool useSource)
        {
            MigrationItemStrings file1   = new MigrationItemStrings("folder1/file1.txt", "folder2/file1.txt", TestEnvironment, useSource);
            MigrationItemStrings file2   = new MigrationItemStrings("folder1/file2.txt", "folder2/file2.txt", TestEnvironment, useSource);
            MigrationItemStrings folder1 = new MigrationItemStrings("folder1/", "folder2/", TestEnvironment, useSource);

            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceWorkspace.PendRename(folder1.ServerPath, folder1.NewServerPath);
            SourceWorkspace.PendDelete(file1.NewServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MultiActionComment);
        }
Esempio n. 11
0
        private void MergeDeletePendUndelete(MigrationItemStrings item, int changesetId)
        {
            int deletionId = SourceTfsClient.GetChangeset(SourceAdapter.DeleteItem(item.ServerPath)).Changes[0].Item.DeletionId;

            SourceWorkspace.Merge(source.LocalPath, target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            // Check in only the merge|delete; so that the undelete may be merged over
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            // pend undelete
            SourceWorkspace.PendUndelete(item.ServerPath, deletionId);
        }
Esempio n. 12
0
        public void BatchMergeTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);

            MigrationItemStrings[] mergeFiles = new MigrationItemStrings[200];

            // Add files
            // Create a tree structure so that we can test path compression logic.
            for (int i = 0; i < 10; i++)
            {
                mergeFiles[i] = new MigrationItemStrings(string.Format("source/mergeFile{0}.txt", i), null, TestEnvironment, true);
                pendAdd(mergeFiles[i].LocalPath);
            }
            for (int i = 10; i < 50; i++)
            {
                mergeFiles[i] = new MigrationItemStrings(string.Format("source/sub1/mergeFile{0}.txt", i), null, TestEnvironment, true);
                pendAdd(mergeFiles[i].LocalPath);
            }
            for (int i = 50; i < 150; i++)
            {
                mergeFiles[i] = new MigrationItemStrings(string.Format("source/sub2/mergeFile{0}.txt", i), null, TestEnvironment, true);
                pendAdd(mergeFiles[i].LocalPath);
            }
            for (int i = 150; i < 200; i++)
            {
                mergeFiles[i] = new MigrationItemStrings(string.Format("source/sub1/sub11/mergeFile{0}.txt", i), null, TestEnvironment, true);
                pendAdd(mergeFiles[i].LocalPath);
            }

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), AddComment);

            // The branch
            int branchChangeset = SourceAdapter.BranchItem(branch);

            #region Setup after Branch operation
            for (int i = 0; i < 200; i++)
            {
                pendEdit(mergeFiles[i].LocalPath);
            }

            #endregion Setup after Branch operation

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            //The big merge
            SourceAdapter.MergeItem(branch, branchChangeset);

            RunAndValidate();
        }
Esempio n. 13
0
        public void RenameWithSourceRename()
        {
            MigrationItemStrings file1 = new MigrationItemStrings("1.txt", "2.txt", TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings("3.txt", "1.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(file1.ServerPath, file1.NewServerPath);
            SourceWorkspace.PendRename(file2.ServerPath, file2.NewServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);

            RunAndValidate();
        }
Esempio n. 14
0
        public void RenameToDeletedItemTest()
        {
            MigrationItemStrings renameFile = new MigrationItemStrings("file1.txt", "file2.txt", TestEnvironment, true);
            MigrationItemStrings deleteFile = new MigrationItemStrings("file2.txt", null, TestEnvironment, true);

            SourceAdapter.AddFile(renameFile.LocalPath);
            SourceAdapter.AddFile(deleteFile.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendDelete(deleteFile.ServerPath);
            SourceWorkspace.PendRename(renameFile.ServerPath, renameFile.NewServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Delete file2.txt and rename file1.txt to file2.txt");

            RunAndValidate();
        }
Esempio n. 15
0
        public void RenameAddNamespaceReuseTest()
        {
            MigrationItemStrings file = new MigrationItemStrings("a.txt", "b.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(file.ServerPath, file.NewServerPath);

            TestUtils.CreateRandomFile(file.LocalPath, 10);

            SourceWorkspace.PendAdd(file.LocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Rename a.txt to b.txt and add a.txt in the same changeset.");

            RunAndValidate();
        }
Esempio n. 16
0
        protected void RenameOrderScenario(bool useSource)
        {
            MigrationItemStrings parentDirectory = new MigrationItemStrings("Parent", "NewDir", TestEnvironment, useSource);
            MigrationItemStrings subDirectory1   = new MigrationItemStrings("Parent/SubDir1", "SubDir1", TestEnvironment, useSource);
            MigrationItemStrings subDirectory2   = new MigrationItemStrings("Parent/SubDir2", "SubDir2", TestEnvironment, useSource);

            SourceAdapter.AddFolder(parentDirectory.LocalPath);
            SourceAdapter.AddFolder(subDirectory1.LocalPath);
            SourceAdapter.AddFolder(subDirectory2.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(subDirectory1.LocalPath, subDirectory1.NewLocalPath);
            SourceWorkspace.PendRename(subDirectory2.LocalPath, subDirectory2.NewLocalPath);
            SourceWorkspace.PendRename(parentDirectory.LocalPath, parentDirectory.NewLocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);
        }
Esempio n. 17
0
        public void ReverseMergeTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath);

            SourceAdapter.EditFile(file.NewLocalPath);

            SourceWorkspace.Merge(branch.NewServerPath, branch.ServerPath,
                                  VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            RunAndValidate();
        }
Esempio n. 18
0
            public void UndeleteParentButNotChildTest()
            {
                MigrationItemStrings file   = new MigrationItemStrings("folder/file.txt", "folder/file.txt", TestEnvironment, true);
                MigrationItemStrings folder = new MigrationItemStrings("folder", "folder", TestEnvironment, true);

                SourceAdapter.AddFile(file.LocalPath);

                int  deleteChangesetId = SourceAdapter.DeleteItem(folder.ServerPath);
                Item item = SourceTfsClient.GetChangeset(deleteChangesetId).Changes[0].Item;

                SourceWorkspace.Get();
                SourceWorkspace.PendUndelete(folder.ServerPath, item.DeletionId);
                SourceWorkspace.Undo(file.ServerPath);
                SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Migration Test undelete");

                RunAndValidate();
            }
Esempio n. 19
0
        public void RenameParentAddSubFolderTest()
        {
            MigrationItemStrings parentFolder = new MigrationItemStrings("parent", "new-parent", TestEnvironment, true);
            MigrationItemStrings file         = new MigrationItemStrings("filea.txt", null, TestEnvironment, true);
            MigrationItemStrings subFolder    = new MigrationItemStrings("new-parent/subdir", null, TestEnvironment, true);

            SourceAdapter.AddFolder(parentFolder.LocalPath);
            SourceAdapter.AddFile(Path.Combine(parentFolder.LocalPath, file.Name));

            SourceWorkspace.PendRename(parentFolder.ServerPath, parentFolder.NewServerPath);
            Directory.CreateDirectory(subFolder.LocalPath);
            SourceWorkspace.PendAdd(subFolder.LocalPath);
            SourceWorkspace.PendRename(Path.Combine(parentFolder.NewServerPath, file.Name), Path.Combine(subFolder.ServerPath, file.Name));

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "added a new sub folder. moved an item to the sub folder. rename parent folder");

            RunAndValidate();
        }
Esempio n. 20
0
        public void RenameParentMoveToBelowItselfTest()
        {
            MigrationItemStrings file            = new MigrationItemStrings("parent/file.txt", null, TestEnvironment, true);
            MigrationItemStrings parentFolder    = new MigrationItemStrings("parent", null, TestEnvironment, true);
            MigrationItemStrings newParentFolder = new MigrationItemStrings("newparent", null, TestEnvironment, true);
            MigrationItemStrings subFolder       = new MigrationItemStrings("parent/subFolder", null, TestEnvironment, true);
            MigrationItemStrings newFileLocation = new MigrationItemStrings("parent/subFolder/file.txt", null, TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            Directory.CreateDirectory(subFolder.LocalPath);
            SourceWorkspace.PendRename(file.ServerPath, newFileLocation.ServerPath);
            SourceWorkspace.PendRename(parentFolder.ServerPath, newParentFolder.ServerPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Move a folder below itsself");

            RunAndValidate();
        }
Esempio n. 21
0
        protected void DeleteFolderRenameToSourceScenario(bool useSoruce)
        {
            MigrationItemStrings parent = new MigrationItemStrings("Parent/", "newParent/", TestEnvironment, useSoruce);
            MigrationItemStrings file1  = new MigrationItemStrings("child/def.txt", "Parent/child/def.txt", TestEnvironment, useSoruce);
            MigrationItemStrings file2  = new MigrationItemStrings("Parent/child/def.txt", null, TestEnvironment, useSoruce);
            MigrationItemStrings child  = new MigrationItemStrings("child/", "Parent/child/", TestEnvironment, useSoruce);

            SourceAdapter.AddFolder(parent.LocalPath);


            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceWorkspace.PendDelete(child.NewServerPath);
            SourceWorkspace.PendRename(child.ServerPath, child.NewServerPath);
            SourceWorkspace.PendRename(parent.ServerPath, parent.NewServerPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment);
        }
Esempio n. 22
0
        protected void ChainedRenameEdit(bool useSource)
        {
            MigrationItemStrings file1 = new MigrationItemStrings("CodeGenProject.vb", null, TestEnvironment, useSource);
            MigrationItemStrings file2 = new MigrationItemStrings("CodeGenSolution.vb", null, TestEnvironment, useSource);
            MigrationItemStrings file3 = new MigrationItemStrings("CodeGenTable.vb", null, TestEnvironment, useSource);

            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            TestUtils.EditRandomFile(file1.LocalPath);
            SourceWorkspace.PendEdit(file1.LocalPath);
            TestUtils.EditRandomFile(file2.LocalPath);
            SourceWorkspace.PendEdit(file2.LocalPath);
            SourceWorkspace.PendRename(file1.LocalPath, file3.LocalPath);
            SourceWorkspace.PendRename(file2.LocalPath, file1.LocalPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "ChainedRenameEdit test");
        }
Esempio n. 23
0
        public void RenameFolderUnderItselfTest()
        {
            MigrationItemStrings file         = new MigrationItemStrings("folder/file.txt", null, TestEnvironment, true);
            MigrationItemStrings movedFolder  = new MigrationItemStrings("folder", "temp-folder", TestEnvironment, true);
            MigrationItemStrings tempFolder   = new MigrationItemStrings("temp-folder", "folder/folder", TestEnvironment, true);
            MigrationItemStrings parentFolder = new MigrationItemStrings("folder", null, TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.PendRename(movedFolder.ServerPath, movedFolder.NewServerPath);

            Directory.CreateDirectory(parentFolder.LocalPath);
            SourceWorkspace.PendAdd(parentFolder.LocalPath);

            SourceWorkspace.PendRename(tempFolder.ServerPath, tempFolder.NewServerPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Move a folder below itsself");

            RunAndValidate();
        }
Esempio n. 24
0
        public void MultipleDeletesTest()
        {
            file = new MigrationItemStrings("folder/file.txt", null, TestEnvironment, true);
            MigrationItemStrings file1 = new MigrationItemStrings("folder/file1.txt", null, TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings("folder/file2.txt", null, TestEnvironment, true);
            MigrationItemStrings file3 = new MigrationItemStrings("folder/file3.txt", null, TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFile(file3.LocalPath);

            SourceWorkspace.PendDelete(file.LocalPath);
            SourceWorkspace.PendDelete(file1.LocalPath);
            SourceWorkspace.PendDelete(file2.LocalPath);
            SourceWorkspace.PendDelete(file3.LocalPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Multiple deletes.");

            RunAndValidate();
        }
Esempio n. 25
0
        public void RollbackEditDeleteTest()
        {
            MigrationItemStrings sourceFile = new MigrationItemStrings("a.txt", null, TestEnvironment, true);

            SourceAdapter.AddFile(sourceFile.LocalPath);

            int deleteChangesetId = SourceAdapter.DeleteItem(sourceFile.LocalPath);

            int deletionId = SourceWorkspace.VersionControlServer.GetChangeset(deleteChangesetId).Changes[0].Item.DeletionId;

            SourceWorkspace.Get();
            SourceWorkspace.PendUndelete(sourceFile.ServerPath, deletionId);

            TestUtils.EditRandomFile(sourceFile.LocalPath);
            SourceWorkspace.PendEdit(sourceFile.LocalPath);
            int editChangesetId = SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "UndeleteEdit");

            // 2. Rollback the undelete|edit
            SourceAdapter.Rollback(editChangesetId, editChangesetId);

            RunAndValidate();
        }
Esempio n. 26
0
        public void MergeNonRecursiveTest()
        {
            MigrationItemStrings source = new MigrationItemStrings("source", "source2", TestEnvironment, true);
            MigrationItemStrings target = new MigrationItemStrings("target", null, TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            int branchChangeset = SourceAdapter.BranchItem(source.ServerPath, target.ServerPath);

            SourceAdapter.EditFile(m_extraFile.LocalPath);
            SourceAdapter.EditFile(file.LocalPath);
            SourceAdapter.RenameItem(source.ServerPath, source.NewServerPath, "Rename source");

            SourceWorkspace.Merge(source.NewServerPath, target.ServerPath,
                                  VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.None, MergeOptions.ForceMerge);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            SourceAdapter.EditFile(m_extraFile.LocalPath);

            RunAndValidate();
        }
Esempio n. 27
0
        public void MergeBaselessTest()
        {
            MigrationItemStrings source = new MigrationItemStrings("source", null, TestEnvironment, true);
            MigrationItemStrings target = new MigrationItemStrings("target", null, TestEnvironment, true);
            MigrationItemStrings file1  = new MigrationItemStrings("source/File.txt", null, TestEnvironment, true);
            MigrationItemStrings file2  = new MigrationItemStrings("source/File2.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(source.LocalPath);
            SourceAdapter.AddFolder(target.LocalPath);
            int changeid = SourceAdapter.AddFile(file1.LocalPath);

            SourceAdapter.AddFile(file2.LocalPath);

            SourceAdapter.EditFile(file2.LocalPath);

            SourceWorkspace.Merge(source.ServerPath, target.ServerPath,
                                  VersionSpec.ParseSingleSpec(changeid.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.Baseless);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            RunAndValidate();
        }
Esempio n. 28
0
        public void CloakedSourceMappingsTest()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source", "target", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("source" + SourceAdapter.PathSeparator + "file.txt",
                                                                   "source" + SourceAdapter.PathSeparator + "renamedFile.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            MappingPair mapping = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source",
                                                  TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source",
                                                  true); // cloaked

            TestEnvironment.AddMapping(mapping);

            int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath);

            SourceAdapter.EditFile(m_extraFile.LocalPath);
            SourceAdapter.EditFile(file.LocalPath);
            SourceAdapter.RenameItem(file.ServerPath, file.NewServerPath);

            SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath,
                                  VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);
            ResolveConflicts(Resolution.AcceptTheirs);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment);

            Run();
            VerifyHistory(5, 0);

            // Resolve "Branch source path not found conflict" using "$/" scope.
            ConflictResolver  conflictManager = new ConflictResolver(Configuration);
            List <RTConflict> conflicts       = conflictManager.GetConflicts();

            Assert.AreEqual(1, conflicts.Count, "There should be only 1 conflict");
            conflictManager.TryResolveConflict(conflicts[0], new VCChangeToAddOnBranchSourceNotMappedAction(), "$/"); // Add on branch source not found

            RunAndValidate(true, true);
        }
Esempio n. 29
0
        public void MergeDeleteUndeleteTest()
        {
            MigrationItemStrings folder = new MigrationItemStrings(source.Name + "folder/", null, TestEnvironment, true);

            file = new MigrationItemStrings(folder.Name + "file.txt", null, TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            int changesetId = SourceAdapter.BranchItem(source.ServerPath, target.ServerPath);

            MergeDeletePendUndelete(folder, changesetId);

            SourceWorkspace.PendDelete(file.ServerPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MultiActionComment);

            SourceWorkspace.Merge(source.LocalPath, target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            resolveConflictAcceptThiers();

            RunAndValidate();
        }
Esempio n. 30
0
        public void RenameParentLongerChildshorterTest()
        {
            MigrationItemStrings folder = new MigrationItemStrings("folder", "folder" + stringOf150Chars, TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("folder/file" + stringOf150Chars + ".txt", "folder/file.txt", TestEnvironment, true);

            MigrationItemStrings folder2 = new MigrationItemStrings("folder2" + stringOf150Chars, "folder2", TestEnvironment, true);
            MigrationItemStrings file2   = new MigrationItemStrings("folder2" + stringOf150Chars + "/file.txt", "folder2/file.txt" + stringOf150Chars + ".txt", TestEnvironment, true);


            SourceAdapter.AddFolder(folder.LocalPath);
            SourceAdapter.AddFile(file.LocalPath);
            SourceAdapter.AddFolder(folder2.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(file.LocalPath, file.NewLocalPath);
            SourceWorkspace.PendRename(folder.LocalPath, folder.NewLocalPath);
            SourceWorkspace.PendRename(folder2.LocalPath, folder2.NewLocalPath);
            SourceWorkspace.PendRename(file2.LocalPath, file2.NewLocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Rename folder longer and file shorter");

            RunAndValidate();
        }