예제 #1
0
        private void PendUndelete(string serverPath, int deleteChangeSetId)
        {
            Item item = SourceTfsClient.GetChangeset(deleteChangeSetId).Changes[0].Item;

            SourceWorkspace.Get();
            SourceWorkspace.PendUndelete(serverPath, item.DeletionId);
        }
예제 #2
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);
        }
예제 #3
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();
            }
예제 #4
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();
        }
예제 #5
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();
        }
예제 #6
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());
        }
예제 #7
0
        private void PendUndelete(MigrationItemStrings folder)
        {
            int deletionId = SourceTfsClient.GetChangeset(SourceAdapter.DeleteItem(folder.ServerPath)).Changes[0].Item.DeletionId;

            SourceWorkspace.PendUndelete(folder.ServerPath, deletionId);
        }