public void TestDeletedWithMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            Difference difference =
                BuildMergeTreeResult.CreateFileAddedDifference("/foo/bar.c");
            Difference differenceMeta =
                BuildMergeTreeResult.CreateFileAddedDifference("/foo/bar.c.meta");

            conflicts.DeletesToApply.Add(difference);
            conflicts.DeletesToApply.Add(differenceMeta);

            UnityIncomingChangesTree tree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
                IncomingChangesTree.BuildIncomingChangeCategories(
                    conflicts,
                    new GetConflictResolutionMock(),
                    rootMountPointWithPath));

            IncomingChangeInfo addedChangeInfo = FindChangeInfo.FromDifference(
                difference, tree);

            Assert.IsNotNull(
                addedChangeInfo,
                "ChangeInfo not found");

            Assert.IsNotNull(
                tree.GetMetaChange(addedChangeInfo),
                "Meta change should not be null");
        }
Exemple #2
0
        public void TestMovedNoMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            Difference difference =
                BuildMergeTreeResult.CreateMovedDifference("/foo/bar.c", "/foo/var.c");

            conflicts.MovesToApply.Add(difference);

            UnityIncomingChangesTree tree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
                MergeChangesTree.BuildForIncomingChangesView(
                    conflicts,
                    new GetConflictResolutionMock(),
                    rootMountPointWithPath));

            MergeChangeInfo changeInfo = FindChangeInfo.FromDifference(
                difference, tree);

            Assert.IsNotNull(
                changeInfo,
                "ChangeInfo not found");

            Assert.IsNull(
                tree.GetMetaChange(changeInfo),
                "Meta change should be null");
        }
        public void TestChangedWithDeletedMeta()
        {
            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            Difference changed = Build.ChangedDifference(
                "/foo/bar.c");

            Difference deletedMeta = Build.DeletedDifference(
                "/foo/bar.c.meta");

            OutOfDateItemsByMount outOfDateItems = new OutOfDateItemsByMount()
            {
                Mount = rootMountPointWithPath
            };

            outOfDateItems.Changed.Add(changed);
            outOfDateItems.Deleted.Add(deletedMeta);

            CheckedStateManager          checkedStateManager   = new CheckedStateManager();
            List <OutOfDateItemsByMount> outOfDateItemsByMount =
                new List <OutOfDateItemsByMount>();
            List <GluonFileConflict> fileConflicts = new List <GluonFileConflict>();

            outOfDateItemsByMount.Add(outOfDateItems);

            IncomingChangesTree innerTree = IncomingChangesTree.BuildIncomingChangeCategories(
                checkedStateManager,
                outOfDateItemsByMount,
                fileConflicts);

            UnityIncomingChangesTree tree =
                UnityIncomingChangesTree.BuildIncomingChangeCategories(innerTree);

            IncomingChangeInfo changeInfo = FindChangeInfo.FromDifference(
                changed, tree);

            IncomingChangeInfo deleteInfo = FindChangeInfo.FromDifference(
                deletedMeta, tree);

            Assert.IsNotNull(
                changeInfo,
                "ChangeInfo not found");

            Assert.IsNotNull(
                deleteInfo,
                "DeleteInfo not found");

            Assert.IsNull(
                tree.GetMetaChange(changeInfo),
                "Meta change should be null");
        }
        public void TestChangedMovedWithMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            FileConflict fileConflict =
                BuildMergeTreeResult.CreateFileConflict("/foo/var.c");

            FileConflict fileConflictMeta =
                BuildMergeTreeResult.CreateFileConflict("/foo/var.c.meta");

            Difference difference =
                BuildMergeTreeResult.CreateMovedDifference("/foo/bar.c", "/foo/var.c");
            Difference differenceMeta =
                BuildMergeTreeResult.CreateMovedDifference("/foo/bar.c.meta", "/foo/var.c.meta");

            conflicts.FilesModifiedOnSource.Add(fileConflict);
            conflicts.FilesModifiedOnSource.Add(fileConflictMeta);
            conflicts.MovesToApply.Add(difference);
            conflicts.MovesToApply.Add(differenceMeta);

            UnityIncomingChangesTree tree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
                IncomingChangesTree.BuildIncomingChangeCategories(
                    conflicts,
                    new GetConflictResolutionMock(),
                    rootMountPointWithPath));

            IncomingChangeInfo fileChangeInfo = FindChangeInfo.FromFileConflict(
                fileConflict, tree);
            IncomingChangeInfo differenceChangeInfo = FindChangeInfo.FromDifference(
                difference, tree);

            Assert.IsNotNull(
                fileChangeInfo,
                "FileConflict not found");

            Assert.IsNotNull(
                differenceChangeInfo,
                "Difference not found");

            Assert.IsNotNull(
                tree.GetMetaChange(fileChangeInfo),
                "Meta change for file conflict not should be null");

            Assert.IsNotNull(
                tree.GetMetaChange(differenceChangeInfo),
                "Meta change for difference not should be null");
        }
        public void TestChangedWithDeletedMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            FileConflict modified =
                BuildMergeTreeResult.CreateModifiedDifference("/foo/bar.c");

            Difference deletedMeta =
                BuildMergeTreeResult.CreateDeletedDifference("/foo/bar.c.meta");

            conflicts.FilesModifiedOnSource.Add(modified);
            conflicts.DeletesToApply.Add(deletedMeta);

            UnityIncomingChangesTree tree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
                IncomingChangesTree.BuildIncomingChangeCategories(
                    conflicts,
                    new GetConflictResolutionMock(),
                    rootMountPointWithPath));

            IncomingChangeInfo changeInfo = FindChangeInfo.FromFileConflict(
                modified, tree);

            IncomingChangeInfo deleteInfo = FindChangeInfo.FromDifference(
                deletedMeta, tree);

            Assert.IsNotNull(
                changeInfo,
                "ChangeInfo not found");

            Assert.IsNotNull(
                deleteInfo,
                "DeleteInfo not found");

            Assert.IsNull(
                tree.GetMetaChange(changeInfo),
                "Meta change should be null");
        }