microsoft / microsoft/azure-devops-python-api
AttributeError: 'dict' object has no attribute 'version_type' when trying to use git_client.get_commits search_criteria
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 684
- Fork
- 218
- Merge trung bình
- 8 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
When trying to get all the commits on a branch I get an attribute error.
Code:
from azure.devops.connection import Connection
from azure.devops.v7_0.git import GitClient
from azure.devops.v7_0.git.models import GitQueryCommitsCriteria
from msrest.authentication import BasicAuthentication
cm_search_criteria = GitQueryCommitsCriteria(
item_version={"version": branch_name,"versionType": 'branch'}
)
print (f"search critera")
print (cm_search_criteria)
print (f"search critera")
commits = git_client.get_commits(
repo_name,
project=project_name,
search_criteria=cm_search_criteria
)
Results:
Traceback (most recent call last):
File "C:\PythonWork\Tool Connectivity\ADO_ALL_REPOS_BRANCHES_COMMITS.py", line 66, in
commits = git_client.get_commits(
repo_name,
project=project_name,
search_criteria=cm_search_criteria
)
File "C:\Users\tmoran\AppData\Local\Programs\Python\Python313\Lib\site-packages\azure\devops\v7_0\git\git_client_base.py", line 361, in get_commits
if search_criteria.item_version.version_type is not None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'version_type'
I cannot see anything wrong with the code, but it is throwing an error, does any one see an error?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với azure/devops/v7_0/git/git_client_base.py ở khoảng dòng 361 và model GitQueryCommitsCriteria được get_commits sử dụng. So sánh cấu trúc model item_version được mong đợi với dictionary được cung cấp trong ví dụ. Hoàn thành khi các tiêu chí branch có thể được truyền vào get_commits mà không gây ra AttributeError và truy vấn commit hoàn tất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, python
- Lĩnh vực
- api, devops
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100