microsoft / microsoft/azure-devops-python-api

Getting incorrect return from get_commit_diffs()

オープン
#497 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
684
フォーク
218
平均マージ
8日 10時間
マージ済み PR(30日)
1

説明

I'm trying to get the diff between two commit, therefore using this API as,

            ref_heads = git_client.get_refs(repository_id=REPOSITORY_ID, project=PROJECT_NAME, filter=target_branch)
            master_commit_id = ref_heads.value[0].object_id
            source_commit_id = pull_request.last_merge_source_commit.commit_id

            base_version_descriptor = GitBaseVersionDescriptor(version_type='commit', version=master_commit_id)
            target_version_descriptor = GitTargetVersionDescriptor(version_type='commit', version=source_commit_id)

            commit_diffs = git_client.get_commit_diffs(repository_id=REPOSITORY_ID, project=PROJECT_NAME,
                                                       diff_common_commit=True,
                                                        base_version_descriptor=base_version_descriptor,
                                                        target_version_descriptor=target_version_descriptor)

while print the commit_diffs, having output as,

Diffs Response: {'additional_properties': {}, 'ahead_count': 0, 'all_changes_included': True, 'base_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415', 'behind_count': 0, 'change_counts': {}, 'changes': [], 'common_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415', 'target_commit': 'b106b44eebeef93d5240f08dca8ceb0124ca4415'}

whereas, using curl to set direct REST request, returns correct output.

"https://dev.azure.com/ORGANIZATION/project/_apis/git/repositories/a21206d3-9bdb-41c4-8b77-56f82360a311e/diffs/commits?baseVersionType=commit&baseVersion=b106b44eebeef93d5240f08dca8ceb0124ca4415&targetVersionType=commit&targetVersion=165c197e54d689e9910eb111b9c14e2516184dd8&api-version=6.0"

What is the correct way to use the get_commit_diff()? Or what I'm doing wrong?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

エントリポイントの get_commit_diffs() から開始し、Python の引数を issue に示されている REST リクエストと比較します。特にベースコミットとターゲットコミットの記述子を確認してください。呼び出しを再現し、返された base_commit、target_commit、changes が直接の REST レスポンスと一致するか検証します。Python API が期待される diff を返せば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, python
領域
api, devops
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。