def merge(self, revision=None):
<EOL>self.create()<EOL>self.ensure_working_tree()<EOL>revision = revision or self.default_revision<EOL>logger.info("<STR_LIT>", revision, format_path(self.local))<EOL>try:<EOL><INDENT>self.context.execute(*self.get_merge_command(revision))<EOL><DEDENT>except ExternalCommandFailed as e:<EOL><INDENT>conflicts = self.merge_conflicts<EOL>if conflicts:<EOL><INDENT>explanation = format("<STR_LIT>",<EOL>pluralize(len(conflicts), "<STR_LIT:file>"),<EOL>concatenate(sorted(conflicts)))<EOL>logger.warning("<STR_LIT:%s>", explanation)<EOL>if self.merge_conflict_handler(e):<EOL><INDENT>return<EOL><DEDENT>else:<EOL><INDENT>raise MergeConflictError(explanation)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>
Merge a revision into the current branch (without committing the result).

:param revision: The revision to merge in (a string or :data:`None`,
                 defaults to :attr:`default_revision`).
:raises: The following exceptions can be raised:

         - :exc:`~vcs_repo_mgr.exceptions.MergeConflictError` if the
           merge command reports an error and merge conflicts are
           detected that can't be (or haven't been) resolved
           interactively.
         - :exc:`~executor.ExternalCommandFailed` if the merge command
           reports an error but no merge conflicts are detected.

Refer to the documentation of :attr:`merge_conflict_handler` if you
want to customize the handling of merge conflicts.