示例#1
0
        private static Dictionary <string, Diff> CompareTags(Descriptor target, Tags oldTags, Tags newTags)
        {
            var tagChanges = new Dictionary <string, Diff>();

            oldTags.ClearBadData();
            newTags.ClearBadData();

            // Record tags that were added.
            Tags addTags = new Tags(newTags.Except(oldTags));

            if (addTags.Count > 0)
            {
                string signature = addTags.Signature;

                Diff diffAdd = Added(signature + " to", target, false);
                diffAdd.Context = addTags;

                tagChanges.Add('+' + signature, diffAdd);
            }

            // Record tags that were removed.
            Tags removeTags = new Tags(oldTags.Except(newTags));

            if (removeTags.Count > 0)
            {
                string signature = removeTags.Signature;

                Diff diffRemove = Removed(signature + " from", target);
                diffRemove.Context = removeTags;

                tagChanges.Add('-' + signature, diffRemove);
            }

            return(tagChanges);
        }