Esempio n. 1
0
        public void RenameWithSourceNotMappedTest()
        {
            MigrationItemStrings folder = new MigrationItemStrings("rename-from", "rename-to", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("rename-from/fld/file.txt", "rename-to/fld/file.txt", TestEnvironment, true);

            // Add the child item
            SourceAdapter.AddFile(file.LocalPath);

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

            TestEnvironment.AddMapping(mapping);

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

            SourceAdapter.EditFile(file.NewLocalPath);

            Run();
            VerifyHistory(3, 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. 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
        public void RenameDeleteMergeTest2()
        {
            MigrationItemStrings sourceFolder = new MigrationItemStrings(source.Name + "folder/", source.Name + "renamed-folder/", TestEnvironment, true);

            file = new MigrationItemStrings(sourceFolder.Name + "file.txt", sourceFolder.NewName + "file.txt", TestEnvironment, true);
            MigrationItemStrings file2         = new MigrationItemStrings(sourceFolder.Name + "file2.txt", sourceFolder.NewName + "file2.txt", TestEnvironment, true);
            MigrationItemStrings sourceFolder2 = new MigrationItemStrings(source.Name + "folder2/", source.Name + "renamed-folder2/", TestEnvironment, true);

            int changesetId = SourceAdapter.AddFile(file.LocalPath);

            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFolder(sourceFolder2.LocalPath);
            SourceAdapter.BranchItem(source.ServerPath, target.ServerPath);

            PendRenameDelete(sourceFolder, file);
            SourceWorkspace.PendRename(sourceFolder2.LocalPath, sourceFolder2.NewLocalPath);

            CheckinMergeResolve(changesetId);

            if (TestEnvironment.SourceTFSVersion == TFSVersionEnum.TFS2010)
            {
                Run();
                Assert.IsTrue(VerifyContents());
            }
            else
            {
                RunAndValidate();
            }
        }
Esempio n. 4
0
        private void RenameMergeRenameScenario(bool includeEdit)
        {
            // Add a file
            MigrationItemStrings sourceFolder = new MigrationItemStrings(m_source.Name + "folder/", null, TestEnvironment, true);

            m_file = new MigrationItemStrings(sourceFolder.Name + "file1.txt", null, TestEnvironment, true);
            SourceAdapter.AddFile(m_file.LocalPath);

            // Branch the containing folder
            int changesetId = SourceAdapter.BranchItem(m_source, m_target);

            // Rename the file and check it in
            MigrationItemStrings rename1 = new MigrationItemStrings(sourceFolder.Name + "file1.txt", sourceFolder.Name + "file2.txt", TestEnvironment, true);

            SourceWorkspace.PendRename(rename1.LocalPath, rename1.NewLocalPath);

            // Checkin the rename & pend a merge
            CheckinMergeResolve(changesetId);

            MigrationItemStrings targetFolder = new MigrationItemStrings(m_target.Name + "folder/", null, TestEnvironment, true);
            MigrationItemStrings rename2      = new MigrationItemStrings(targetFolder.Name + "file2.txt", targetFolder.Name + "file3.txt", TestEnvironment, true);

            SourceWorkspace.PendRename(rename2.LocalPath, rename2.NewLocalPath);

            if (includeEdit)
            {
                SourceAdapter.EditFile(rename2.NewLocalPath);
            }

            RunAndValidate();

            VerifyNoExtraMergeCandidates();
        }
Esempio n. 5
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. 6
0
        public void RenameDeleteMergeTest2()
        {
            MigrationItemStrings sourceFolder = new MigrationItemStrings(m_source.Name + "folder/", m_source.Name + "renamed-folder/", TestEnvironment, true);

            m_file = new MigrationItemStrings(sourceFolder.Name + "file.txt", sourceFolder.NewName + "file.txt", TestEnvironment, true);
            MigrationItemStrings file2         = new MigrationItemStrings(sourceFolder.Name + "file2.txt", sourceFolder.NewName + "file2.txt", TestEnvironment, true);
            MigrationItemStrings sourceFolder2 = new MigrationItemStrings(m_source.Name + "folder2/", m_source.Name + "renamed-folder2/", TestEnvironment, true);

            int changesetId = SourceAdapter.AddFile(m_file.LocalPath);

            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFolder(sourceFolder2.LocalPath);
            SourceAdapter.BranchItem(m_source, m_target);

            PendRenameDelete(sourceFolder, m_file);
            SourceWorkspace.PendRename(sourceFolder2.LocalPath, sourceFolder2.NewLocalPath);

            CheckinMergeResolve(changesetId);

            if (TestEnvironment.SourceEndPoint.IsTfsAdapter &&
                TestEnvironment.SourceEndPoint.AdapterType >= AdapterType.TFS2010VC)
            {
                Run();
                Assert.IsTrue(VerifyContents());
            }
            else
            {
                RunAndValidate();
            }
        }
Esempio n. 7
0
        public void RenameEditUndeleteMergeTest()
        {
            int changesetId = AddBranch();

            MergeDeletePendUndelete(m_file, changesetId);
            SourceWorkspace.PendRename(m_file.ServerPath, m_file.NewServerPath);
            SourceAdapter.EditFile(m_file.NewLocalPath);

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

            resolveConflictAcceptThiers();

            if (TestEnvironment.SourceEndPoint.IsTfsAdapter &&
                TestEnvironment.SourceEndPoint.AdapterType >= AdapterType.TFS2010VC)
            {
                Run();
                Assert.IsTrue(VerifyContents());
            }
            else
            {
                RunAndValidate();
            }
        }
Esempio n. 8
0
        private void PendRenameEdit(MigrationItemStrings file)
        {
            TestUtils.EditRandomFile(file.LocalPath);

            SourceWorkspace.PendEdit(file.LocalPath);
            SourceWorkspace.PendRename(file.LocalPath, file.NewLocalPath);
        }
Esempio n. 9
0
        public void RenameEditUndeleteTest()
        {
            file = new MigrationItemStrings("file.txt", "newFile.txt", TestEnvironment, true);

            EditUndelete(file);
            SourceWorkspace.PendRename(file.LocalPath, file.NewLocalPath);

            RunAndValidate();
        }
Esempio n. 10
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. 11
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. 12
0
        public void RenameFolderEditFileTest()
        {
            file = new MigrationItemStrings("folder/file.txt", "newName/file.txt", TestEnvironment, true);
            MigrationItemStrings folder = new MigrationItemStrings("folder", "newName", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            TestUtils.EditRandomFile(file.LocalPath);

            SourceWorkspace.PendEdit(file.LocalPath);
            SourceWorkspace.PendRename(folder.LocalPath, folder.NewLocalPath);
            RunAndValidate();
        }
Esempio n. 13
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. 14
0
        public void RenameCaseAddSubitemTest()
        {
            MigrationItemStrings folder = new MigrationItemStrings("FOLDER", "folder", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("folder/file.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(folder.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(folder.ServerPath, folder.NewServerPath);
            SourceAdapter.AddFile(file.LocalPath);

            RunAndValidate();
        }
Esempio n. 15
0
        protected void UndeleteSourceRenameScenario(bool useSource)
        {
            MigrationItemStrings deletedFile = new MigrationItemStrings("file.txt", null, TestEnvironment, useSource);
            MigrationItemStrings renamedFile = new MigrationItemStrings("file.txt", "renamedFile.txt", TestEnvironment, useSource);

            SourceAdapter.AddFile(deletedFile.LocalPath);
            int deletionChangeSet = SourceAdapter.DeleteItem(deletedFile.ServerPath);

            SourceAdapter.AddFile(renamedFile.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(renamedFile.LocalPath, renamedFile.NewLocalPath);
            SourceAdapter.UndeleteFile(deletedFile.ServerPath, deletionChangeSet);
        }
Esempio n. 16
0
        public void MergeAddSourceRename()
        {
            MigrationItemStrings folder = new MigrationItemStrings(m_source.Name + "folder", m_source.Name + "folder-rename", TestEnvironment, true);

            SourceAdapter.AddFolder(folder.LocalPath);
            int changesetId = SourceWorkspace.PendBranch(m_source.ServerPath, m_target.ServerPath, ChangesetVersionSpec.Latest);

            SourceWorkspace.PendRename(folder.LocalPath, folder.NewLocalPath);

            CheckinMergeResolve(changesetId);

            SourceAdapter.AddFolder(folder.LocalPath.Replace("source", "target") + "\\sub"); // Pend an add on the source rename item

            RunAndValidate();
        }
Esempio n. 17
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. 18
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. 19
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. 20
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. 21
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. 22
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. 23
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. 24
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. 25
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. 26
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();
        }
Esempio n. 27
0
        public void UndeleteCaseOnlyRenameTest()
        {
            MigrationItemStrings folder = new MigrationItemStrings("folder", "Folder", TestEnvironment, true);
            MigrationItemStrings file   = new MigrationItemStrings("file.txt", "File.txt", TestEnvironment, true);

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

            int deleteChangeset = SourceAdapter.DeleteItem(folder.ServerPath);

            Item item = SourceTfsClient.GetChangeset(deleteChangeset).Changes[0].Item;

            SourceWorkspace.Get();
            SourceWorkspace.PendUndelete(folder.LocalPath, item.DeletionId);
            SourceWorkspace.PendUndelete(file.LocalPath, item.DeletionId);

            SourceWorkspace.PendRename(folder.ServerPath, folder.NewServerPath);
            SourceWorkspace.PendRename(file.LocalPath, file.NewLocalPath);

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


            RunAndValidate();
        }
Esempio n. 28
0
        public void SnapshotMergeRenameEditTest()
        {
            // scenario
            // branch from source to target where source is cloaked
            // take the snapshot of target branch
            // item1 on source renamed,edited
            // item1 was merged to target
            // VC session converts merge,rename,edit to add,edit

            // cloak branch from path
            MappingPair mapping = new MappingPair(
                TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source",
                TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source",
                true);

            TestEnvironment.AddMapping(mapping);


            MigrationItemStrings file1 = new MigrationItemStrings(
                string.Format("source{0}folder1{1}file1.txt", SrcPathSeparator, SrcPathSeparator),
                string.Format("source{0}folder2{1}file1.txt", SrcPathSeparator, SrcPathSeparator),
                TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings(
                string.Format("source{0}folder2{1}file2.txt", SrcPathSeparator, SrcPathSeparator),
                null, TestEnvironment, true);
            MigrationItemStrings file3 = new MigrationItemStrings(
                string.Format("source{0}folder1{1}file3.txt", SrcPathSeparator, SrcPathSeparator),
                string.Format("source{0}folder2{1}file3.txt", SrcPathSeparator, SrcPathSeparator),
                TestEnvironment, true);

            // branch
            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFile(file3.LocalPath);

            int changesetId         = SourceAdapter.BranchItem(source.ServerPath, target.ServerPath);
            int snapshotChangesetId = SourceAdapter.EditFile(file2.LocalPath);

            // pend edit on file1
            SourceWorkspace.PendEdit(file1.LocalPath);
            TestUtils.EditRandomFile(file1.LocalPath);
            // pend rename (file1 is moved to a different location)
            SourceWorkspace.PendRename(file1.LocalPath, file1.NewLocalPath);
            // pend edit on file2
            SourceWorkspace.PendEdit(file2.LocalPath);
            TestUtils.EditRandomFile(file2.LocalPath);
            // pend rename (file3 is moved to a different location)
            SourceWorkspace.PendEdit(file3.LocalPath);
            SourceWorkspace.PendRename(file3.LocalPath, file3.NewLocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "rename, edit");


            // merge changes from source to target
            // - merge,rename,edit on file1
            // - merge,edit on file2
            // - merge,rename on file3
            SourceWorkspace.Merge(source.LocalPath, target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            resolveConflictAcceptThiers();

            changesetId = SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "merge,rename,edit");

            // snapshot
            TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>();
            TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceTeamProject, snapshotChangesetId.ToString());
            TestEnvironment.SnapshotBatchSize = 100;

            Run();

            // 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

            Run();
            Assert.IsTrue(VerifyContents());
        }
Esempio n. 29
0
        public void SnapshotMergeUndeleteRenameTest()
        {
            // scenario
            // branch from source to target where source is cloaked
            // item1 on source was edited, deleted
            // item1 on source was undelete, renamed (case-only rename) (snapshot start point)
            // item1 was merged to target
            // migration uses a snapshot start point which skips migrating deletion
            // hence undelete, rename becomes add, rename

            // cloak branch from path
            MappingPair mapping = new MappingPair(
                TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source",
                TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source",
                true);

            TestEnvironment.AddMapping(mapping);

            MigrationItemStrings file1 = new MigrationItemStrings("source/folder/file1.txt", "source/Folder/File1.txt", TestEnvironment, true);
            MigrationItemStrings file2 = new MigrationItemStrings("source/folder/file2.txt", "source/folder/File2.txt", TestEnvironment, true);
            MigrationItemStrings file3 = new MigrationItemStrings("source/folder/file3.txt", null, TestEnvironment, true);

            // branch
            SourceAdapter.AddFile(file1.LocalPath);
            SourceAdapter.AddFile(file2.LocalPath);
            SourceAdapter.AddFile(file3.LocalPath);

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

            // merge edit
            // merge delete
            SourceAdapter.EditFile(file1.LocalPath);
            int deletionId = SourceTfsClient.GetChangeset(SourceAdapter.DeleteItem(file1.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);

            changesetId = SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "edit -> delete");

            // pend undelete
            SourceWorkspace.PendUndelete(file1.ServerPath, deletionId);

            // pend rename
            SourceWorkspace.PendRename(file1.LocalPath, file1.NewLocalPath);
            SourceWorkspace.PendRename(file2.LocalPath, file2.NewLocalPath);
            TestUtils.EditRandomFile(file3.LocalPath);
            SourceWorkspace.PendEdit(file3.LocalPath);

            changesetId = SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "undelete rename");
            int snapshotChangesetId = changesetId;

            // merge undelete,rename skipping deletion
            // migrating merge,undelete,rename becomes add,rename
            SourceWorkspace.Merge(source.LocalPath, target.LocalPath,
                                  VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName),
                                  VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None);

            resolveConflictAcceptThiers();
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "merge undelete rename");

            // snapshot
            TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>();
            TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceTeamProject, snapshotChangesetId.ToString());
            TestEnvironment.SnapshotBatchSize = 100;

            Run();

            // 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

            Run();
            Assert.IsTrue(VerifyContents());
        }
Esempio n. 30
0
 private void PendUndeleteRename(MigrationItemStrings file)
 {
     PendUndelete(file);
     SourceWorkspace.PendRename(file.LocalPath, file.NewLocalPath);
 }