##// END OF EJS Templates
vcs: use a real two part name for merge operation....
marcink -
r3101:bd815778 default
parent child Browse files
Show More
@@ -485,9 +485,9 b' class BaseRepository(object):'
485 :param close_branch: If `True` branch will be close before merging it
485 :param close_branch: If `True` branch will be close before merging it
486 """
486 """
487 if dry_run:
487 if dry_run:
488 message = message or 'dry_run_merge_message'
488 message = message or settings.MERGE_DRY_RUN_MESSAGE
489 user_email = user_email or 'dry-run-merge@rhodecode.com'
489 user_email = user_email or settings.MERGE_DRY_RUN_EMAIL
490 user_name = user_name or 'Dry-Run User'
490 user_name = user_name or settings.MERGE_DRY_RUN_USER
491 else:
491 else:
492 if not user_name:
492 if not user_name:
493 raise ValueError('user_name cannot be empty')
493 raise ValueError('user_name cannot be empty')
@@ -54,6 +54,14 b' HOOKS_DIRECT_CALLS = False'
54 HOOKS_HOST = '127.0.0.1'
54 HOOKS_HOST = '127.0.0.1'
55
55
56
56
57 MERGE_MESSAGE_TMPL = (
58 u'Merge pull request #{pr_id} from {source_repo} {source_ref_name}\n\n '
59 u'{pr_title}')
60 MERGE_DRY_RUN_MESSAGE = 'dry_run_merge_message_from_rhodecode'
61 MERGE_DRY_RUN_USER = 'Dry-Run User'
62 MERGE_DRY_RUN_EMAIL = 'dry-run-merge@rhodecode.com'
63
64
57 def available_aliases():
65 def available_aliases():
58 """
66 """
59 Mercurial is required for the system to work, so in case vcs.backends does
67 Mercurial is required for the system to work, so in case vcs.backends does
@@ -608,23 +608,24 b' class PullRequestModel(BaseModel):'
608 def _merge_pull_request(self, pull_request, user, extras, merge_msg=None):
608 def _merge_pull_request(self, pull_request, user, extras, merge_msg=None):
609 target_vcs = pull_request.target_repo.scm_instance()
609 target_vcs = pull_request.target_repo.scm_instance()
610 source_vcs = pull_request.source_repo.scm_instance()
610 source_vcs = pull_request.source_repo.scm_instance()
611 target_ref = self._refresh_reference(
612 pull_request.target_ref_parts, target_vcs)
613
611
614 message = merge_msg or (
612 message = safe_unicode(merge_msg or vcs_settings.MERGE_MESSAGE_TMPL).format(
615 'Merge pull request #%(pr_id)s from '
613 pr_id=pull_request.pull_request_id,
616 '%(source_repo)s %(source_ref_name)s\n\n %(pr_title)s') % {
614 pr_title=pull_request.title,
617 'pr_id': pull_request.pull_request_id,
615 source_repo=source_vcs.name,
618 'source_repo': source_vcs.name,
616 source_ref_name=pull_request.source_ref_parts.name,
619 'source_ref_name': pull_request.source_ref_parts.name,
617 target_repo=target_vcs.name,
620 'pr_title': pull_request.title
618 target_ref_name=pull_request.target_ref_parts.name,
621 }
619 )
622
620
623 workspace_id = self._workspace_id(pull_request)
621 workspace_id = self._workspace_id(pull_request)
624 repo_id = pull_request.target_repo.repo_id
622 repo_id = pull_request.target_repo.repo_id
625 use_rebase = self._use_rebase_for_merging(pull_request)
623 use_rebase = self._use_rebase_for_merging(pull_request)
626 close_branch = self._close_branch_before_merging(pull_request)
624 close_branch = self._close_branch_before_merging(pull_request)
627
625
626 target_ref = self._refresh_reference(
627 pull_request.target_ref_parts, target_vcs)
628
628 callback_daemon, extras = prepare_callback_daemon(
629 callback_daemon, extras = prepare_callback_daemon(
629 extras, protocol=vcs_settings.HOOKS_PROTOCOL,
630 extras, protocol=vcs_settings.HOOKS_PROTOCOL,
630 host=vcs_settings.HOOKS_HOST,
631 host=vcs_settings.HOOKS_HOST,
@@ -635,10 +636,12 b' class PullRequestModel(BaseModel):'
635 # for a single call.
636 # for a single call.
636 target_vcs.config.set(
637 target_vcs.config.set(
637 'rhodecode', 'RC_SCM_DATA', json.dumps(extras))
638 'rhodecode', 'RC_SCM_DATA', json.dumps(extras))
639
640 user_name = user.short_contact
638 merge_state = target_vcs.merge(
641 merge_state = target_vcs.merge(
639 repo_id, workspace_id, target_ref, source_vcs,
642 repo_id, workspace_id, target_ref, source_vcs,
640 pull_request.source_ref_parts,
643 pull_request.source_ref_parts,
641 user_name=user.username, user_email=user.email,
644 user_name=user_name, user_email=user.email,
642 message=message, use_rebase=use_rebase,
645 message=message, use_rebase=use_rebase,
643 close_branch=close_branch)
646 close_branch=close_branch)
644 return merge_state
647 return merge_state
@@ -305,7 +305,7 b' class TestPullRequestModel(object):'
305 pull_request.target_ref_parts,
305 pull_request.target_ref_parts,
306 pull_request.source_repo.scm_instance(),
306 pull_request.source_repo.scm_instance(),
307 pull_request.source_ref_parts,
307 pull_request.source_ref_parts,
308 user_name=user.username, user_email=user.email, message=message,
308 user_name=user.short_contact, user_email=user.email, message=message,
309 use_rebase=False, close_branch=False
309 use_rebase=False, close_branch=False
310 )
310 )
311 self.invalidation_mock.assert_called_once_with(
311 self.invalidation_mock.assert_called_once_with(
@@ -345,7 +345,7 b' class TestPullRequestModel(object):'
345 pull_request.target_ref_parts,
345 pull_request.target_ref_parts,
346 pull_request.source_repo.scm_instance(),
346 pull_request.source_repo.scm_instance(),
347 pull_request.source_ref_parts,
347 pull_request.source_ref_parts,
348 user_name=user.username, user_email=user.email, message=message,
348 user_name=user.short_contact, user_email=user.email, message=message,
349 use_rebase=False, close_branch=False
349 use_rebase=False, close_branch=False
350 )
350 )
351
351
General Comments 0
You need to be logged in to leave comments. Login now