Git or Hg Repository exceeds number of allowed committers
Symptoms
Adding a Git repository to Fisheye with a Starter license (10 users) installed will sometimes produce an error stating that there are more than 10 committers, even though there are less than 10 real people who have committed:
Repository index failed due to error - class com.atlassian.fisheye.dvcs.handler.DvcsProcessRuntimeException: com.cenqua.fisheye.LicensePolicyException: Exceeded number of allowed committers
Cause
You have exceeded the number of committers allowed by the Starter License. This is either a legitimate occurrence (you have more than 10 actual committers) or this problem can also affect git and Mercurial Starter License users over time when their committers use different ids to commit to the repository.
Due to this change (
) in Fisheye 2.6, when we scan a git repository, we now combine the author and email fields from the commit into a single field that Fisheye uses to determine who the committer is. This allows automatic email mapping to map the commit by that committer to a Fisheye User with the same email address.Unfortunately, if your committers use different email addresses for their commits, they will now count as more than one committer, where previously they did not.
Resolution
For Mercurial, the only solution is to rewrite the history of your repository to map these committers to a single consistent committer id for each real committer you have (and to encourage them to be consistent in future).
This means getting all developers to delete their clones of the repository and re-clone once the history re-write is complete. Otherwise, they will probably end up pushing the old commits back into the repository being scanned by Fisheye and the problem will reoccur.
Warning
Be very sure you know what you are doing during this process: you are re-writing history and the wrong command could lose all of your repositories history and your source code. Keep a backup clone of your repository in case something goes wrong.
Rewriting history is also valid for git (detailed below), but git has an easier alternative, using the .mailmap file. This allows the git repository to report to Fisheye different names and email addresses than were actually used by the author - this will not affect any other repositories, unless they also get the .mailmap file in their local repositories. See the git shortlog man page for more details.
Fisheye will use the version of the .mailmap
file that is checked in at HEAD
. This is normally the latest commit on master
(or your default branch, if you have set it to other than master
).
Once you set this up, you will need to go to the administration console in Fisheye for your repository and under the 'Maintenance' tab, select 'Re-clone and Re-index'. Any changes you make to the .mailmap
file will not take affect until you 'Re-clone and Re-index'.
Note that if you want to map multiple email addresses to one author, you need to specify them on multiple lines.
E.g.
John Doe <john.doe@newcompany.com> <john@oldcompany.com>
John Doe <john.doe@newcompany.com> <johndoe@oldcompany.com>
John Doe <john.doe@newcompany.com> <jdoe@oldcompany.com>
Mercurial
In Mercurial, we use the Convert Extension to rewrite the committer names, using an authormap file. In the repository that Fisheye is scanning, you will need to use the Mercurial Queues Strip command to remove all the current commits once the converted repository is ready, otherwise you will simply add a new set of commits next to the originals.
Get a copy of the repository and use:
hg log --template "{author}\n" | sort | uniq
to list the current committer names.
- Identify those you want to rewrite and add an entry into a authormap file to rewrite them to another address.
Run:
hg convert my-clone rewritten-clone
- Strip the repository that Fisheye is indexing and push the
rewritten-clone
into it. Make sure all your developers use clones of the new copy of the repository from now on, otherwise they will possibly push back all the old commits and the problem will reoccur). - Go to the administration console in Fisheye for your repository and under the 'Maintenance' tab, select 'Re-clone and Re-index'.
Git
This method will rewrite your commits with undesired author/emails in them, changing history. An easier approach (see above) is to use the .mailmap file as mentioned in the git shortlog man page. You will need to reclone and re-index after setting that up.
Fisheye uses the git author name and email fields on a commit to identify who made the changes (which in Fisheye is referred to as the "committer", but in git is the author; in git, the committer is who committed, possibly on behalf of the author), so we need to remap them.
To rewrite the committer names in git, use the git filter-branch. You need to create a script to check for each committer you want to remap, and replace the name and email fields. The command needs to be run for each branch you have that you wish to modify:
git filter-branch --commit-filter ' if [ "$GIT_AUTHOR_NAME" = "<Old Name>" ]; then GIT_AUTHOR_NAME="<New Name>"; GIT_AUTHOR_EMAIL="<New Email>"; elif [ "$GIT_AUTHOR_NAME" = "<Other Old Name>" ]; then GIT_AUTHOR_NAME="<Other New Name>"; GIT_AUTHOR_EMAIL="<Other New Email>"; fi; git commit-tree "$@"' Branch
Replace
Branch
with each branch you need to modify.
Note the warnings on the git filter-branch page.- Once the process is complete and your repository only contains the rewritten author names and email addresses, go to the adminstration console in Fisheye for your repository and under the 'Maintenance' tab, select 'Re-clone and Re-index'.