Exemplo n.º 1
0
        ///	<summary>
        /// Merge together two or more tree-ish objects.
        /// <para />
        /// Any tree-ish may be supplied as inputs. Commits and/or tags pointing at
        /// trees or commits may be passed as input objects.
        /// </summary>
        /// <param name="tips">
        /// source trees to be combined together. The merge base is not
        /// included in this set. </param>
        /// <returns>
        /// True if the merge was completed without conflicts; false if the
        /// merge strategy cannot handle this merge or there were conflicts
        /// preventing it from automatically resolving all paths.
        /// </returns>
        /// <exception cref="IncorrectObjectTypeException">
        /// one of the input objects is not a commit, but the strategy
        /// requires it to be a commit.
        /// </exception>
        /// <exception cref="IOException">
        /// one or more sources could not be read, or outputs could not
        /// be written to the Repository.
        /// </exception>
        public virtual bool Merge(AnyObjectId[] tips)
        {
            _sourceObjects = new RevObject[tips.Length];
            for (int i = 0; i < tips.Length; i++)
            {
                _sourceObjects[i] = _walk.parseAny(tips[i]);
            }

            _sourceCommits = new RevCommit[_sourceObjects.Length];
            for (int i = 0; i < _sourceObjects.Length; i++)
            {
                try
                {
                    _sourceCommits[i] = _walk.parseCommit(_sourceObjects[i]);
                }
                catch (IncorrectObjectTypeException)
                {
                    _sourceCommits[i] = null;
                }
            }

            SourceTrees = new RevTree[_sourceObjects.Length];
            for (int i = 0; i < _sourceObjects.Length; i++)
            {
                SourceTrees[i] = _walk.parseTree(_sourceObjects[i]);
            }

            return(MergeImpl());
        }