Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Map commit authors to Phabricator accounts

Tags:

phabricator

We have different authentication systems for our Subversion repository and our Phabricator installation.

But it seems that Phabricator assumes that the commit authors and Phabricator accounts will be the same. No where in the documenation it is mentioned how commit authors are mapped to Phabricator accounts.

Is it possible to have different accounts names with Phabricator?

How can we map the commit authors and Phabricator accounts?

like image 673
onknows Avatar asked Jan 08 '23 03:01

onknows


1 Answers

Phabricator supports a few types of event listener for extending its functionality. One of the available listeners is TYPE_DIFFUSION_LOOKUPUSER, which can intercept a user lookup from diffusion. I wrote a listener to make use of this to lookup the svnalias file which I made available here: https://github.com/make-all/libphalias

In my case, I had already changed svn to use the same authentication source as Phabricator, and just kept old names as aliases in the svnalias file, so the historical checkins can be linked to the correct user in Diffusion. My plugin basically only directly takes care of that use case.

If you want to keep using the old names in svn, it will probably work to simply modify the path to the alias file to use a different file so as not to interfere with svn, but in the same format. Or if you have some other way of mapping the names already, you could just use my plugin as an example.

Once installed and configured with the alias list, any new checkins should get linked to the phabricator user. To deal with existing checkins that Phabricator has already imported, you need to run bin/repository reparse --all <REPO> --message with <REPO> replaced by the phabricator name for your repository.

Assuming you have a user steven in Phabricator, who has been known as steve in svn (or other systems), your alias file should include the following:

[aliases]
steve = steven

If you have changed the usernames in svn to sync them with phabricator, and only want this for historical purposes, then the file can be /etc/subversion/aliases itself, but if you don't want to affect svn, then use a different file with the same format.

like image 104
JSON Avatar answered Jan 19 '23 03:01

JSON