Map commit authors to Phabricator accounts

1.1k views Asked by At

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?

2

There are 2 answers

6
JSON On

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.

0
Thomas On

Just a quick note to state that this is now built in to Phabricator. Each commit's identity is tracked and the mapping to phab user can be managed by administrators.

https://secure.phabricator.com/T12164