コード例 #1
0
        public void RecursiveBranchDeleteTest()
        {
            file = new MigrationItemStrings(source.Name + "file.txt", target.Name + "file.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.PendBranch(source.ServerPath, target.ServerPath, VersionSpec.Latest);
            SourceAdapter.DeleteItem(target.ServerPath);

            RunAndValidate();
        }
コード例 #2
0
        public void BranchEditTest()
        {
            file = new MigrationItemStrings(source.Name + "file.txt", target.Name + "file.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.PendBranch(source.ServerPath, target.ServerPath, VersionSpec.Latest);
            TestUtils.EditRandomFile(file.NewLocalPath);
            SourceWorkspace.PendEdit(file.NewLocalPath);

            RunAndValidate();
        }
コード例 #3
0
        public void BranchDeleteTest()
        {
            m_file = new MigrationItemStrings(m_source.Name + "file.txt", m_target.Name + "file.txt", TestEnvironment, true);

            SourceAdapter.AddFile(m_file.LocalPath);

            SourceWorkspace.PendBranch(m_source.ServerPath, m_target.ServerPath, VersionSpec.Latest);
            SourceWorkspace.PendDelete(m_file.NewLocalPath);

            SourceAdapter.EditFile(m_extraFile.LocalPath);

            RunAndValidate();
        }
コード例 #4
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();
        }
コード例 #5
0
        protected void BranchParitalScenario()
        {
            MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true);
            MigrationItemStrings file1  = new MigrationItemStrings("source/file1.txt", null, TestEnvironment, true);
            MigrationItemStrings file2  = new MigrationItemStrings("source/file2.txt", null, TestEnvironment, true);

            SourceAdapter.AddFolder(branch.LocalPath);
            SourceAdapter.AddFile(file1.LocalPath);
            int branchFrom = SourceAdapter.AddFile(file2.LocalPath);

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

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendBranch(branch.ServerPath, branch.NewServerPath, VersionSpec.ParseSingleSpec(branchFrom.ToString(), Environment.UserName));

            RunAndValidate();
        }
コード例 #6
0
        public void PathSnapshotBranchTest()
        {
            MigrationItemStrings branch  = new MigrationItemStrings("source/", "target/", TestEnvironment, true);
            MigrationItemStrings branch2 = new MigrationItemStrings("source/", "target2/", TestEnvironment, true);

            MigrationItemStrings[] addFiles = new MigrationItemStrings[10];

            // Add files
            // Create a tree structure so that we can test path compression logic.
            int sessionSnapshotChangesetId = 1;

            for (int i = 0; i < 10; i++)
            {
                addFiles[i] = new MigrationItemStrings(
                    string.Format("source/addFile{0}.txt", i),
                    string.Format("source/addFile{0}-rename.txt", i),
                    TestEnvironment,
                    true);

                SourceAdapter.AddFile(addFiles[i].LocalPath);
            }

            int editBeforeSnapshotChangesetId  = SourceAdapter.EditFile(addFiles[2].LocalPath);
            int editBeforeSnapshotChangesetId2 = SourceAdapter.EditFile(addFiles[2].LocalPath);


            SourceAdapter.RenameItem(addFiles[3].ServerPath, addFiles[3].NewServerPath, "Rename before snapshot");

            int deleteChangesetID = SourceAdapter.DeleteItem(addFiles[4].ServerPath);

            SourceAdapter.DeleteItem(addFiles[5].ServerPath);

            SourceAdapter.UndeleteFile(addFiles[4].ServerPath, deleteChangesetID);

            int path2SnapshotChangesetId = SourceAdapter.RenameItem(addFiles[6].ServerPath, addFiles[6].NewServerPath, "Rename before snapshot");

            int editAfterSnapshotChangesetId  = SourceAdapter.EditFile(addFiles[6].NewLocalPath);
            int editAfterSnapshotChangesetId2 = SourceAdapter.EditFile(addFiles[6].NewLocalPath);

            SourceAdapter.DeleteItem(addFiles[4].ServerPath);
            SourceAdapter.RenameItem(addFiles[3].NewServerPath, addFiles[3].ServerPath, "Rename after snapshot");

            // Branch from a version before the snapshot
            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendBranch(branch.ServerPath, branch.NewServerPath, new ChangesetVersionSpec(editBeforeSnapshotChangesetId));
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Branch from a version before snapshot");

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



            TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>();
            TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceTeamProject, sessionSnapshotChangesetId.ToString());
            TestEnvironment.SnapshotBatchSize = 3;

            // We need to map to the sub item level
            MappingPair rootMapping = TestEnvironment.Mappings[0];

            TestEnvironment.Mappings.Clear();
            TestEnvironment.Mappings.Add(new MappingPair(rootMapping.SourcePath + "/target", rootMapping.TargetPath + "/target", false));
            TestEnvironment.Mappings.Add(new MappingPair(rootMapping.SourcePath + "/target2", rootMapping.TargetPath + "/target2", false));
            TestEnvironment.Mappings.Add(new MappingPair(rootMapping.SourcePath + "/source", rootMapping.TargetPath + "/source", false, path2SnapshotChangesetId.ToString(), null));

            Run();

            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], ConflictConstant.TFSHistoryNotFoundSkipAction, "1-" + path2SnapshotChangesetId);
            Run(true, true);

            // ToDo, ideally, we should compare content at snapshot changeset and compare history after snapshot changeset.
            Assert.IsTrue(VerifyContents());
        }