Adding multiple Jira issue keys to Perforce changelists may cause Jira to display incorrect number of commits associated to an issue

XMLWordPrintable

    • Severity 3 - Minor

      Issue Summary

      If a Jira issue was moved between projects and a Perforce changelist happens to include both issue keys (old and new) the number of commits associated to that issue is counted twice.

      Steps to Reproduce

      You must have Jira and Fisheye/Crucible connected using AppLinks to reproduce this problem.

      1. Add a Perforce repository to Fisheye/Crucible. Let's call the repository Perforce1.
      2. Create a new Jira issue e.g. FORCE-1
      3. Submit changelist to Perforce1 including "FORCE-1" in the comments.
      4. Once the changelist/ commit starts showing up inside your Jira issue, look for the following in the database:
        select *
          from "AO_575BF5_DEV_SUMMARY"
         where "JSON" like '%FORCE-1%';
        
        CREATED ID ISSUE_ID JSON PROVIDER_SOURCE_ID UPDATED
        2021-01-26 17:07:03 11 10101 {"value":{"targets":{"FORCE-1":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2021-01-26T17:06:59.000+0000","count":1,"commits":["3"],"type":"p4"}]},{"type":{"id":"review"},"objects":[]},{"type":{"id":"branch"},"objects":[]}]}},"expiry":9223371721494775807} d4cbcfce-60db-3178-960d-311f3240cdd5 2021-01-26 17:07:09
      5. Now move FORCE-1 to a new project e.g. THANOS-7.
      6. Submit a new changelist to Perforce1 including "THANOS-7" in the comments.
      7. Let's look inside the Jira database again:
        CREATED ID ISSUE_ID JSON PROVIDER_SOURCE_ID UPDATED
        2021-01-26 17:07:03 11 10101 {"value":{"targets":{"THANOS-7":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2021-01-26T17:09:50.000+0000","count":1,"commits":["4"],"type":"p4"}]},{"type":{"id":"review"},"objects":[]},{"type":{"id":"branch"},"objects":[]}],"FORCE-1":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2021-01-26T17:06:59.000+0000","count":1,"commits":["3"],"type":"p4"}]},{"type":{"id":"review"},"objects":[]},{"type":{"id":"branch"},"objects":[]}]}},"expiry":9223371721494775807} d4cbcfce-60db-3178-960d-311f3240cdd5 2021-01-26 17:10:03
      8. So far, so good. There are 2 unique changelists associated to that Jira issue inside the database and the Development panel is telling us there are 2 commits linked to it.
      9. Now, submit a new changelist containing THANOS-7 and FORCE-1.

      Expected Results

      The Development panel should display 3 unique changelists/ commits associated to your Jira issue.

      Actual Results

      The Development panel is now reporting 4 commits associated to my issue when there's in fact only 3 unique commits. The following message is displayed when expanding/ clicking the commits in Jira:

      You don't have access to view all related commits. Please contact your administrator.

      The Development panel displays the details of 3 commits (this is accurate) but it says there are 4 commits (wrong) and we don't have access to see all of them.

      Let's look again inside the Jira database:

      CREATED ID ISSUE_ID JSON PROVIDER_SOURCE_ID UPDATED
      2021-01-26 17:07:03 11 10101 {"value":{"targets":{"THANOS-7":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2021-01-26T17:13:28.000+0000","count":2,"commits":["4","5"],"type":"p4"}]},{"type":{"id":"review"},"objects":[]},{"type":{"id":"branch"},"objects":[]}],"FORCE-1":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2021-01-26T17:13:28.000+0000","count":2,"commits":["5","3"],"type":"p4"}]},{"type":{"id":"review"},"objects":[]},{"type":{"id":"branch"},"objects":[]}]}},"expiry":9223371721494775807} d4cbcfce-60db-3178-960d-311f3240cdd5 2021-01-26 17:14:03

      Changelist 5 is showing up twice for THANOS-7 and FORCE-1. The Development panel should be able to tell them apart and identify unique commits only.

      Workaround

      1. Modify/ edit the changelist that includes multiple keys of the same Jira issue p4 change -i -u and remove one of the keys.
      2. Access the Fisheye admin > Repositories > P4REPOSITORY > Maintenance page and click Re-index.
        • A re-index of the repository is necessary because the changelist you're modifying had already been indexed by Fisheye/Crucible.
      3. Submit a new changelist and associate it to your issue to force Jira to update the database record for it.
      4. From this moment on the Development panel will display the correct number of changelists/ commits associated to your Jira issue.

      Notes

      This issue was tested against Perforce and Git repositories. It does not affect Git commits, only Perforce changelists.

            Assignee:
            Unassigned
            Reporter:
            Bruno Rosa
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: