# HG changeset patch # User Martin Bornhold # Date 2016-06-27 11:16:10 # Node ID 978630ac68bb2729a2a9990c9cd3ac6f0a1e6460 # Parent d861bb79bffaf47300a09a759e5a1019c52637e0 settings: Add argument to select rebase as merge strategy. diff --git a/rhodecode/lib/vcs/backends/base.py b/rhodecode/lib/vcs/backends/base.py --- a/rhodecode/lib/vcs/backends/base.py +++ b/rhodecode/lib/vcs/backends/base.py @@ -365,7 +365,8 @@ class BaseRepository(object): raise NotImplementedError def merge(self, target_ref, source_repo, source_ref, workspace_id, - user_name='', user_email='', message='', dry_run=False): + user_name='', user_email='', message='', dry_run=False, + use_rebase=False): """ Merge the revisions specified in `source_ref` from `source_repo` onto the `target_ref` of this repository. @@ -388,6 +389,8 @@ class BaseRepository(object): :param user_email: Merge commit `user_email`. :param message: Merge commit `message`. :param dry_run: If `True` the merge will not take place. + :param use_rebase: If `True` commits from the source will be rebased + on top of the target instead of being merged. """ if dry_run: message = message or 'sample_message' @@ -407,7 +410,8 @@ class BaseRepository(object): try: return self._merge_repo( shadow_repository_path, target_ref, source_repo, - source_ref, message, user_name, user_email, dry_run=dry_run) + source_ref, message, user_name, user_email, dry_run=dry_run, + use_rebase=use_rebase) except RepositoryError: log.exception( 'Unexpected failure when running merge, dry-run=%s', diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -833,7 +833,8 @@ class GitRepository(BaseRepository): def _merge_repo(self, shadow_repository_path, target_ref, source_repo, source_ref, merge_message, - merger_name, merger_email, dry_run=False): + merger_name, merger_email, dry_run=False, + use_rebase=False): if target_ref.commit_id != self.branches[target_ref.name]: return MergeResponse( False, False, None, MergeFailureReason.TARGET_IS_NOT_HEAD) diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -659,7 +659,8 @@ class MercurialRepository(BaseRepository def _merge_repo(self, shadow_repository_path, target_ref, source_repo, source_ref, merge_message, - merger_name, merger_email, dry_run=False): + merger_name, merger_email, dry_run=False, + use_rebase=False): if target_ref.commit_id not in self._heads(): return MergeResponse( False, False, None, MergeFailureReason.TARGET_IS_NOT_HEAD)