Show More
@@ -26,6 +26,8 b' pull request model for RhodeCode' | |||
|
26 | 26 | |
|
27 | 27 | import json |
|
28 | 28 | import logging |
|
29 | import os | |
|
30 | ||
|
29 | 31 | import datetime |
|
30 | 32 | import urllib |
|
31 | 33 | import collections |
@@ -632,6 +634,7 b' class PullRequestModel(BaseModel):' | |||
|
632 | 634 | repo_id = pull_request.target_repo.repo_id |
|
633 | 635 | use_rebase = self._use_rebase_for_merging(pull_request) |
|
634 | 636 | close_branch = self._close_branch_before_merging(pull_request) |
|
637 | user_name = self._user_name_for_merging(pull_request, user) | |
|
635 | 638 | |
|
636 | 639 | target_ref = self._refresh_reference( |
|
637 | 640 | pull_request.target_ref_parts, target_vcs) |
@@ -647,7 +650,6 b' class PullRequestModel(BaseModel):' | |||
|
647 | 650 | target_vcs.config.set( |
|
648 | 651 | 'rhodecode', 'RC_SCM_DATA', json.dumps(extras)) |
|
649 | 652 | |
|
650 | user_name = user.short_contact | |
|
651 | 653 | merge_state = target_vcs.merge( |
|
652 | 654 | repo_id, workspace_id, target_ref, source_vcs, |
|
653 | 655 | pull_request.source_ref_parts, |
@@ -1664,6 +1666,16 b' class PullRequestModel(BaseModel):' | |||
|
1664 | 1666 | |
|
1665 | 1667 | return False |
|
1666 | 1668 | |
|
1669 | def _user_name_for_merging(self, pull_request, user): | |
|
1670 | env_user_name_attr = os.environ.get('RC_MERGE_USER_NAME_ATTR', '') | |
|
1671 | if env_user_name_attr and hasattr(user, env_user_name_attr): | |
|
1672 | user_name_attr = env_user_name_attr | |
|
1673 | else: | |
|
1674 | user_name_attr = 'short_contact' | |
|
1675 | ||
|
1676 | user_name = getattr(user, user_name_attr) | |
|
1677 | return user_name | |
|
1678 | ||
|
1667 | 1679 | def _close_branch_before_merging(self, pull_request): |
|
1668 | 1680 | repo_type = pull_request.target_repo.repo_type |
|
1669 | 1681 | if repo_type == 'hg': |
General Comments 0
You need to be logged in to leave comments.
Login now