Пример #1
0
        /// <summary>
        /// Agregates a changelog from this commit to its ancestor
        /// </summary>
        /// <param name="ancestor">this and ancestor must form a boolean algrebra with ancestor at the top</param>
        /// <returns></returns>
        public AggregatedChangelog AncestorChangelog(Commit ancestor)
        {
            if (ancestor.Hash == Hash)
            {
                return(AggregatedChangelog.EmptyChangelog());
            }
            Commit next = Parents[0];

            for (int i = 1; i < Parents.Length; i++)
            {
                next = LCAFind(next, Parents[i]);
            }
            AggregatedChangelog aggregate = next.AncestorChangelog(ancestor);

            aggregate.AggregateNext(this);
            return(aggregate);
        }
Пример #2
0
        /// <summary>
        /// Aggregates the changelog from initial commit to this commit
        /// </summary>
        /// <returns></returns>
        public AggregatedChangelog AggregateChangelog()
        {
            if (IsNull)
            {
                return(AggregatedChangelog.EmptyChangelog());
            }
            if (Parents.Length == 0 || Parents[0].IsNull)
            {
                return(new AggregatedChangelog(this));
            }
            Commit next = Parents[0];

            for (int i = 1; i < Parents.Length; i++)
            {
                next = LCAFind(next, Parents[i]);
            }
            AggregatedChangelog aggregate = next.AggregateChangelog();

            aggregate.AggregateNext(this);
            return(aggregate);
        }