Git or Hg Repository exceeds number of allowed Committers

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

問題

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.

atlassian-fisheye-<date>.log に次のメッセージが表示される。

WARN  [208:StdOutHandler <repository_name> ] fisheye DefaultLicenseEnforcer-validateCommitterLimit - Committer limit exceeded - committer list: user1 <user1@test.com>, user2 <user2@test.com>, ...
WARN  [InitPing1 <repository_name> ] fisheye BaseRepositoryScanner-setLicensePolicyReached - License limit reached
com.cenqua.fisheye.LicensePolicyException: Exceeded number of allowed committers. Your licenses only allows 10 committers. This repository has 11
	at com.cenqua.fisheye.rep.impl.DefaultLicenseEnforcer.validateCommitterLimit(DefaultLicenseEnforcer.java:74)
	at com.cenqua.fisheye.rep.impl.CommonRevInfoDAO.insertNew(CommonRevInfoDAO.java:483)

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 ( FE-2496 - Getting issue details... STATUS ) 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.

If your committers use different email addresses for their commits, they will now count as more than one committer.

診断

診断ステップ

The full list of committers identified by Fisheye is available in the log files as part of the following line. In the example below "user1 <user1@test.com" and "user2 <user1@test.com>" are the first two of the users identified, this list always contains at least 11 committers.

WARN  [208:StdOutHandler <repository_name> ] fisheye DefaultLicenseEnforcer-validateCommitterLimit - Committer limit exceeded - committer list: user1 <user1@test.com>, user2 <user2@test.com>, ...
Git diagnostic steps

To validate the list of Fisheye committers against the Git ones, performs the following step:

  • run the command:
git shortlog -nse
  • check the returned committers and compare them with the ones available in the Fisheye log files

ソリューション

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.

警告

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 (see below for details).

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.

  1. Get a copy of the repository and use:

    hg log --template "{author}\n" | sort | uniq

    to list the current committer names.

  2. Identify those you want to rewrite and add an entry into a authormap file to rewrite them to another address.
  3. 次のコマンドを実行します。

    hg convert my-clone rewritten-clone
  4. 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).
  5. Go to the administration console in Fisheye for your repository and under the 'Maintenance' tab, select 'Re-clone and Re-index'.

Git

For a Git repository, you can change the committers by editing 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 Mapping Authors paragraph on the Git shortlog 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).

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>
  • create or edit the .mailmap file on the master branch by consolidating the redundant names and email addresses into a limited number below or equal to 10
  • run the git shortlog -sne to make sure that only the desired users are returned
  • commit and push the file to your repository
  • log-in to Fisheye as an Administrator, select the affected repository from the Administration console and trigger the "Re-clone and Re-index" option from the "Maintenance" tab.

Alternative method for Git

The following method will rewrite your commits with undesired author/emails in them, changing history.

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.

  1. 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 --env-filter '
            if test "$GIT_AUTHOR_EMAIL" = "root@localhost"
            then
                    GIT_AUTHOR_EMAIL=john@example.com
                    export GIT_AUTHOR_EMAIL
            fi
            if test "$GIT_COMMITTER_EMAIL" = "root@localhost"
            then
                    GIT_COMMITTER_EMAIL=john@example.com
                    export GIT_COMMITTER_EMAIL
            fi
    ' -- --all
  2. Note the warnings on the git filter-branch page.

  3. Check to make sure you only have the desired users in this repository with git shortlog -sne.
  4. Once the process is complete and your repository only contains the rewritten author names and email addresses, go to the administration console in Fisheye for your repository and under the 'Maintenance' tab, select 'Re-clone and Re-index'.
最終更新日 2018 年 7 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.