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(); } }
private int AddBranch() { m_file = new MigrationItemStrings(m_source.Name + "file.txt", m_source.Name + "renamed-file.txt", TestEnvironment, true); SourceAdapter.AddFile(m_file.LocalPath); return(SourceAdapter.BranchItem(m_source, m_target)); }
private int AddBranch() { file = new MigrationItemStrings(source.Name + "file.txt", source.Name + "renamed-file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); return(SourceAdapter.BranchItem(source.ServerPath, target.ServerPath)); }
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(); } }
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(); }
protected void BranchFileScenario() { MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.BranchItem(file.ServerPath, file.NewServerPath); RunAndValidate(); }
protected void BranchEmptyFolderScenario() { MigrationItemStrings folder = new MigrationItemStrings("source/folder", "target/folder", TestEnvironment, true); SourceAdapter.AddFolder(folder.LocalPath); SourceAdapter.BranchItem(folder.ServerPath, folder.NewServerPath); RunAndValidate(); }
public void BranchEmptyFolderTest() { MigrationItemStrings folder = new MigrationItemStrings("source/folder", "target/folder", TestEnvironment, true); SourceAdapter.AddFolder(folder.LocalPath); SourceAdapter.BranchItem(folder); RunAndValidate(); }
public void BranchFileTest() { MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.BranchItem(file); RunAndValidate(); }
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. } }
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(); }
protected void BranchPopulatedFolderScenario() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings("source/folder/file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("source/folder/file2.txt", null, TestEnvironment, true); SourceAdapter.AddFolder(branch.LocalPath); SourceAdapter.AddFile(file1.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.EditFile(file2.LocalPath); SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); RunAndValidate(); }
public void RenameNamespaceReuseMergeTest() { MigrationItemStrings sourceFolder = new MigrationItemStrings("source/folder", "source/folder-rename", TestEnvironment, true); MigrationItemStrings sourceFile = new MigrationItemStrings("source/folder/file.txt", "source/folder/file.txt", TestEnvironment, true); MigrationItemStrings branchItem = new MigrationItemStrings("source", "target", TestEnvironment, true); SourceAdapter.AddFile(sourceFile.LocalPath); SourceAdapter.BranchItem(branchItem); int deleteChangeset = SourceAdapter.DeleteItem(sourceFile.ServerPath); SourceAdapter.AddFile(sourceFile.LocalPath); SourceAdapter.RenameItem(sourceFolder.ServerPath, sourceFolder.NewServerPath); SourceAdapter.MergeItem(branchItem, deleteChangeset); RunAndValidate(); }
public void MergeSourceRenameAndDeleteTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings folder2 = new MigrationItemStrings("folder2/", null, TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings(branch.Name + "file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings(branch.Name + "file2.txt", folder2.Name + "file2.txt", TestEnvironment, true); SourceAdapter.AddFolder(folder2.LocalPath); SourceAdapter.AddFile(file1.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.BranchItem(branch); SourceAdapter.RenameItem(file2.LocalPath, file2.NewLocalPath); SourceAdapter.DeleteItem(file1.LocalPath); SourceAdapter.MergeItem(branch, 1); RunAndValidate(); }
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(); }