def merge(self, dest, key=None, commit=None, **kwargs):
        """Try to merge two commits together.

        >>> repo.commit('spoon', {'material': 'silver'})
        >>> repo.checkout('spoon', 'fork')
        >>> repo.show('fork')
        {u'material': u'silver'}
        >>> repo.commit('spoon', {'material': 'stainless'})
        >>> merge = repo.merge('fork', 'spoon')
        >>> merge.message
        u'Auto-merge of d0e0aa8061 and ce29b985cf from shared parent d21cb53771'
        >>> repo.show('fork')
        {u'material': u'stainless'}

        :param dest: the key to receive the merge
        :type dest: string
        :param key:
            (optional) the key of the merge source, which will use the head
            commit.
        :type key: string
        :param commit: (optional) the explicit commit to merge
        :type commit: :class:`Commit <jsongit.wrappers.Commit>`
        :param author:
            (optional) The author of this commit, if one is necessary.
            Defaults to global author.
        :type author: pygit2.Signature
        :param committer:
            (optional) The committer of this commit, if one is necessary.
            Will default to global author.
        :type committer: pygit2.Signature

        :returns: The results of the merge operation
        :rtype: :class:`Merge <jsongit.wrappers.Merge>`
        """
        if commit is None:
            commit = self.head(key)
        if commit.key == dest:
            raise ValueError('Cannot merge a key with itself')

        dest_head = self.head(dest)
        # No difference
        if commit.oid == dest_head.oid:
            return Merge(True, commit, dest_head, "Same commit", result=commit)

        # Do a merge if there were no overlapping changes
        # First, find the shared parent
        try:
            shared_commit = (dc for dc in self.log(commit=dest_head)
                             if dc.oid in (sc.oid for sc in self.log(commit=commit))).next()
        except StopIteration:
            return Merge(False, commit, dest_head, "No shared parent")

        # Now, see if the diffs conflict
        source_diff = Diff(shared_commit.data, commit.data)
        dest_diff = Diff(shared_commit.data, dest_head.data)

        conflict = Conflict(source_diff, dest_diff)

        # No-go, the user's gonna have to figure this one out
        if conflict:
            return Merge(False, commit, dest_head, "Merge conflict",
                                conflict=conflict)
        # Sweet. we can apply all the diffs.
        else:
            merged_data = dest_diff.apply(source_diff.apply(shared_commit.data))
            message = "Auto-merge of %s and %s from shared parent %s" % (
                commit.hex[0:10], dest_head.hex[0:10], shared_commit.hex[0:10])
            parents = [dest_head, commit]
            result = self.commit(dest, merged_data, message=message, parents=parents, **kwargs)
            return Merge(True, commit, dest_head, message, result=result)
dataset/ETHPy150Open talos/jsongit/jsongit/models.py/Repository.merge/original