예제 #1
0
        public async Task <ActionResult> DiffApi(string from, string to, int start = 0)
        {
            Logger.WriteLine("Serving root diff for root " + from + " => " + to);

            if (BuildDiffCache.Get(from, to, out ApiDiff diff))
            {
                Logger.WriteLine("Serving cached diff for root " + from + " => " + to);

                return(Json(new
                {
                    added = diff.added.Count(),
                    modified = diff.modified.Count(),
                    removed = diff.removed.Count(),
                    data = diff.all.ToArray()
                }));
            }

            var filedataids = await Database.GetAllFiles();

            var rootFrom = await NGDP.GetRoot(from, true);

            var rootTo = await NGDP.GetRoot(to, true);

            var rootFromEntries = rootFrom.entriesFDID;
            var rootToEntries   = rootTo.entriesFDID;

            var fromEntries = rootFromEntries.Keys.ToHashSet();
            var toEntries   = rootToEntries.Keys.ToHashSet();

            var commonEntries  = fromEntries.Intersect(toEntries);
            var removedEntries = fromEntries.Except(commonEntries);
            var addedEntries   = toEntries.Except(commonEntries);
예제 #2
0
        public ActionResult DiffApiInvalidateCache()
        {
            BuildDiffCache.Invalidate();

            return(Ok());
        }