Ejemplo n.º 1
0
        public void TestDirectoryConflictWithMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            DirectoryConflict directoryConflict =
                BuildMergeTreeResult.CreateEvilTwinConflict("/foo/bar.c");
            DirectoryConflict directoryConflictMeta =
                BuildMergeTreeResult.CreateEvilTwinConflict("/foo/bar.c.meta");

            conflicts.EvilTwins.Add(directoryConflict);
            conflicts.EvilTwins.Add(directoryConflictMeta);

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

            IncomingChangeInfo conflictChangeInfo = FindChangeInfo.FromDirectoryConflict(
                directoryConflict, tree);

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

            Assert.IsNotNull(
                tree.GetMetaChange(conflictChangeInfo),
                "Meta change should not be null");
        }
Ejemplo n.º 2
0
        public void TestChangedNoMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

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

            conflicts.FilesModifiedOnSource.Add(fileConflict);

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

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

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

            Assert.IsNull(
                tree.GetMetaChange(changeInfo),
                "Meta change should be null");
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        public void TestOnlyMeta()
        {
            MergeTreeResult conflicts = new MergeTreeResult();

            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

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

            conflicts.FileConflicts.Add(fileConflictMeta);

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

            IncomingChangeInfo conflictMetaChangeInfo = FindChangeInfo.FromFileConflict(
                fileConflictMeta, tree);

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

            Assert.IsNull(
                tree.GetMetaChange(conflictMetaChangeInfo),
                "Meta change should be null");
        }
Ejemplo n.º 5
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 TestConflictNoMeta()
        {
            MountPointWithPath rootMountPointWithPath = BuildRootMountPointWithPath();

            GluonFileConflict fileConflict = Build.FileConflict(
                rootMountPointWithPath,
                "/foo/bar.c");

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

            fileConflicts.Add(fileConflict);

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

            UnityIncomingChangesTree tree =
                UnityIncomingChangesTree.BuildIncomingChangeCategories(innerTree);

            IncomingChangeInfo conflictChangeInfo = FindChangeInfo.FromFileConflict(
                fileConflict, tree);

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

            Assert.IsNull(
                tree.GetMetaChange(conflictChangeInfo),
                "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");
        }
Ejemplo n.º 8
0
        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");
        }
Ejemplo n.º 9
0
        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(
                MergeChangesTree.BuildForIncomingChangesView(
                    conflicts,
                    new GetConflictResolutionMock(),
                    rootMountPointWithPath));

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

            MergeChangeInfo 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");
        }