[Solved] Username when merging

Hi @all,

is it possible to alter the username of the merge commit to the rc username? If one merges using rc, it uses the full name of the author in the merge commit instead of the username.

For example:
Michael Miller’s username in rc is MMI. In the .hgrc or .gitconfig the username is also set to MMI. MMI now merges a pullrequest using the webinterface. Rc will set the username to Michael Miller .
But I want it to be MMI (Mailaddress is optional)

Best regards

Hi,

This is hardcoded as i just checked. Exactly here: https://code.rhodecode.com/rhodecode-enterprise-ce/files/fd4b2bf5348f1def66ac9495be06eac1e60f8fae/rhodecode/model/pull_request.py#L641

If that would be changed to user.username it would use that for merge. I wonder if we should make this somehow configurable.

Ok, thank you. Is it editable in rhodecode ee without recompiling?

Yes, This is a part of CE code-base. If you’d edit the enterprise-1/profile/etc/rhodecode_enterprise_ce_source and find this part linked in previous comments you can edit it. After restart it should be changed, please be aware any modifications are removed on upgrades via rccontrol.

Thanks Marcin, it works like a charm.
Best regards
Christopher

Hi, I need to reopen this, because after updating I have the same problem again. I can now see, that in pull_request.py there’s a function ‘_user_name_for_merging’. And found the corresponding entry in Release notes RhodeCode Enterprise 4.18.1 Release Notes — RhodeCode Enterprise 4.25.2 4.25.2 documentation

But how do I set RC_MERGE_USER_NAME_ATTR?

Best regards

Hi again,

found out I can append the environment variable in supervisord.ini line ‘environment = PYTHONP…’

I appended RC_MERGE_USER_NAME_ATTR=“username”. Now the in the merge commit the author looks like username <email>
How to get rid of <email>?

I give the answer myself
in file rhodecode/lib/vcs/backends/hg/repository.py in function _local_merge und _local_close

username=safe_str('%s' % (user_name))