##// 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 485 :param close_branch: If `True` branch will be close before merging it
486 486 """
487 487 if dry_run:
488 message = message or 'dry_run_merge_message'
489 user_email = user_email or 'dry-run-merge@rhodecode.com'
490 user_name = user_name or 'Dry-Run User'
488 message = message or settings.MERGE_DRY_RUN_MESSAGE
489 user_email = user_email or settings.MERGE_DRY_RUN_EMAIL
490 user_name = user_name or settings.MERGE_DRY_RUN_USER
491 491 else:
492 492 if not user_name:
493 493 raise ValueError('user_name cannot be empty')
@@ -54,6 +54,14 b' HOOKS_DIRECT_CALLS = False'
54 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 65 def available_aliases():
58 66 """
59 67 Mercurial is required for the system to work, so in case vcs.backends does
@@ -608,23 +608,24 b' class PullRequestModel(BaseModel):'
608 608 def _merge_pull_request(self, pull_request, user, extras, merge_msg=None):
609 609 target_vcs = pull_request.target_repo.scm_instance()
610 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 (
615 'Merge pull request #%(pr_id)s from '
616 '%(source_repo)s %(source_ref_name)s\n\n %(pr_title)s') % {
617 'pr_id': pull_request.pull_request_id,
618 'source_repo': source_vcs.name,
619 'source_ref_name': pull_request.source_ref_parts.name,
620 'pr_title': pull_request.title
621 }
612 message = safe_unicode(merge_msg or vcs_settings.MERGE_MESSAGE_TMPL).format(
613 pr_id=pull_request.pull_request_id,
614 pr_title=pull_request.title,
615 source_repo=source_vcs.name,
616 source_ref_name=pull_request.source_ref_parts.name,
617 target_repo=target_vcs.name,
618 target_ref_name=pull_request.target_ref_parts.name,
619 )
622 620
623 621 workspace_id = self._workspace_id(pull_request)
624 622 repo_id = pull_request.target_repo.repo_id
625 623 use_rebase = self._use_rebase_for_merging(pull_request)
626 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 629 callback_daemon, extras = prepare_callback_daemon(
629 630 extras, protocol=vcs_settings.HOOKS_PROTOCOL,
630 631 host=vcs_settings.HOOKS_HOST,
@@ -635,10 +636,12 b' class PullRequestModel(BaseModel):'
635 636 # for a single call.
636 637 target_vcs.config.set(
637 638 'rhodecode', 'RC_SCM_DATA', json.dumps(extras))
639
640 user_name = user.short_contact
638 641 merge_state = target_vcs.merge(
639 642 repo_id, workspace_id, target_ref, source_vcs,
640 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 645 message=message, use_rebase=use_rebase,
643 646 close_branch=close_branch)
644 647 return merge_state
@@ -305,7 +305,7 b' class TestPullRequestModel(object):'
305 305 pull_request.target_ref_parts,
306 306 pull_request.source_repo.scm_instance(),
307 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 309 use_rebase=False, close_branch=False
310 310 )
311 311 self.invalidation_mock.assert_called_once_with(
@@ -345,7 +345,7 b' class TestPullRequestModel(object):'
345 345 pull_request.target_ref_parts,
346 346 pull_request.source_repo.scm_instance(),
347 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 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