How to find all added or removed commits from Pull Request Updates

お困りですか?

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

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

After a pull request is created, any updates to the branch will cause the pull request to be updated. If the commits listed are more than 5 the UI will show a number of commits added or removed but not list them.  This should show you all of the activity in that pull request. Here is the process to find all of the commits id's of the commits not listed: 

ソリューション

Start with the ID of the pull request from the URL.  When viewing URL of the pull request, the pull request id is the number near the end of the URL.  In this example, "pull-requests/96/overview" is the end of the pull request URL, where '86' will be the ID used in the following query:

SELECT activity_id 
FROM   sta_pr_activity 
WHERE  pr_id = 96;

We can then create new queries on sta_pr_rescope_activity based on the specific activity ID returned above. If you include the above query in your where clause, you can create something like:

SELECT * 
FROM   sta_pr_rescope_activity 
WHERE  activity_id IN 
       ( 
              SELECT activity_id 
              FROM   sta_pr_activity 
              WHERE  pr_id = <activity_id> );

Example output:

 activity_id |                from_hash                 |                 to_hash                  |              prev_from_hash              |               prev_to_hash               | commits_added | commits_removed
-------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+---------------+-----------------
        1855 | 5daa180799c9a0ca85e915cb918e8a869c22bba0 | 6158cc2c288e89b8ea1345c8f46bf30d84fb4780 | c36310e6851897dc067599121125d737fab6cd21 | 6158cc2c288e89b8ea1345c8f46bf30d84fb4780 |             1 |               0
        1857 | fa6952ea38d3362da80fef0d8c7d6bbaf4a38835 | 6158cc2c288e89b8ea1345c8f46bf30d84fb4780 | 5daa180799c9a0ca85e915cb918e8a869c22bba0 | 6158cc2c288e89b8ea1345c8f46bf30d84fb4780 |             1 |               0


This shows you all of the activity in the Pull Request.  The number of commits_removed or commits_added to the pull request will help you limit the number of possible hashes used for the next step.  To get the list of commit id's run these two commands from any of the lines returned in the SQL above.  The column names should be replaced with the actual hash below:

git rev-list --ancestry-path <to_hash>..<from_hash>
git rev-list --ancestry-path <prev_to_hash>..<prev_from_hash>




最終更新日: 2021 年 1 月 20 日

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

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