Example #1
0
        public void TestMovedNoMeta()
        {
            ClientDiff moved = Build.Moved("/foo/bar.src.c", "/foo/bar.c");

            List <ClientDiff> diffs = new List <ClientDiff>();

            diffs.Add(moved);

            UnityDiffTree diffTree = new UnityDiffTree();

            diffTree.BuildCategories(diffs, false);

            ClientDiffInfo clientDiffInfo = FindClientDiffInfo.FromClientDiff(
                moved,
                ChangeCategoryType.Moved,
                diffTree);

            Assert.IsNotNull(
                clientDiffInfo,
                "Moved not found");

            Assert.IsFalse(
                diffTree.HasMeta(clientDiffInfo),
                "Meta exists");
        }
Example #2
0
        public void TestFsPermissionsNoMeta()
        {
            ClientDiff changedFsPermissions = Build.ChangedFsPermissions("/foo/bar.c");

            List <ClientDiff> diffs = new List <ClientDiff>();

            diffs.Add(changedFsPermissions);

            UnityDiffTree diffTree = new UnityDiffTree();

            diffTree.BuildCategories(diffs, false);

            ClientDiffInfo clientDiffInfo = FindClientDiffInfo.FromClientDiff(
                changedFsPermissions,
                ChangeCategoryType.FSProtection,
                diffTree);

            Assert.IsNotNull(
                clientDiffInfo,
                "Changed fs protection not found");

            Assert.IsFalse(
                diffTree.HasMeta(clientDiffInfo),
                "Meta exists");
        }
Example #3
0
            internal static ClientDiffInfo FromClientDiff(
                ClientDiff clientDiff,
                ChangeCategoryType type,
                UnityDiffTree diffTree)
            {
                foreach (ITreeViewNode node in diffTree.GetNodes())
                {
                    ClientDiffInfo result = FindClientDiffOfType(
                        clientDiff.Diff.Path,
                        type,
                        node);

                    if (result != null)
                    {
                        return(result);
                    }
                }

                return(null);
            }
Example #4
0
        public void TestChangeWithDeletedMeta()
        {
            ClientDiff changed     = Build.Changed("/foo/bar.c");
            ClientDiff deletedMeta = Build.Deleted("/foo/bar.c.meta");

            List <ClientDiff> diffs = new List <ClientDiff>();

            diffs.Add(changed);
            diffs.Add(deletedMeta);

            UnityDiffTree diffTree = new UnityDiffTree();

            diffTree.BuildCategories(diffs, false);

            ClientDiffInfo clientDiffInfo = FindClientDiffInfo.FromClientDiff(
                changed,
                ChangeCategoryType.Changed,
                diffTree);

            ClientDiffInfo clientDiffInfoMeta = FindClientDiffInfo.FromClientDiff(
                deletedMeta,
                ChangeCategoryType.Deleted,
                diffTree);

            Assert.IsNotNull(
                clientDiffInfo,
                "Changed not found");

            Assert.IsNotNull(
                clientDiffInfoMeta,
                "Deleted meta not found");

            Assert.IsFalse(
                diffTree.HasMeta(clientDiffInfo),
                "Meta exists");
        }
Example #5
0
        public void TestMergedWithMeta()
        {
            ClientDiff merged     = Build.Merged("/foo/bar.c");
            ClientDiff mergedMeta = Build.Merged("/foo/bar.c.meta");

            List <ClientDiff> diffs = new List <ClientDiff>();

            diffs.Add(merged);
            diffs.Add(mergedMeta);

            UnityDiffTree diffTree = new UnityDiffTree();

            diffTree.BuildCategories(diffs, false);

            ClientDiffInfo clientDiffInfo = FindClientDiffInfo.FromClientDiff(
                merged,
                ChangeCategoryType.Merged,
                diffTree);

            ClientDiffInfo clientDiffInfoMeta = FindClientDiffInfo.FromClientDiff(
                mergedMeta,
                ChangeCategoryType.Merged,
                diffTree);

            Assert.IsNotNull(
                clientDiffInfo,
                "Merged not found");

            Assert.IsNull(
                clientDiffInfoMeta,
                "Merged meta found");

            Assert.IsTrue(
                diffTree.HasMeta(clientDiffInfo),
                "Meta does not exist");
        }
Example #6
0
        public void TestFsPermissionsWithMeta()
        {
            ClientDiff fsPermissionsChange     = Build.ChangedFsPermissions("/foo/bar.c");
            ClientDiff fsPermissionsChangeMeta = Build.ChangedFsPermissions("/foo/bar.c.meta");

            List <ClientDiff> diffs = new List <ClientDiff>();

            diffs.Add(fsPermissionsChange);
            diffs.Add(fsPermissionsChangeMeta);

            UnityDiffTree diffTree = new UnityDiffTree();

            diffTree.BuildCategories(diffs, false);

            ClientDiffInfo clientDiffInfo = FindClientDiffInfo.FromClientDiff(
                fsPermissionsChange,
                ChangeCategoryType.FSProtection,
                diffTree);

            ClientDiffInfo clientDiffInfoMeta = FindClientDiffInfo.FromClientDiff(
                fsPermissionsChangeMeta,
                ChangeCategoryType.FSProtection,
                diffTree);

            Assert.IsNotNull(
                clientDiffInfo,
                "Change fs permissions not found");

            Assert.IsNull(
                clientDiffInfoMeta,
                "Change fs permissions meta found");

            Assert.IsTrue(
                diffTree.HasMeta(clientDiffInfo),
                "Meta does not exist");
        }