microsoft / microsoft/azure-devops-python-api
AttributeError: 'dict' object has no attribute 'version_type' when trying to use git_client.get_commits search_criteria
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 684
- Fork
- 218
- Merge medio
- 8g 10h
- PR unite (30g)
- 1
Descrizione
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?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da azure/devops/v7_0/git/git_client_base.py intorno alla riga 361 e dal modello GitQueryCommitsCriteria usato da get_commits. Confronta la forma prevista del modello item_version con il dizionario fornito nell’esempio. Il lavoro è completato quando i criteri del branch possono essere passati a get_commits senza causare l’AttributeError e la query dei commit viene completata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- azure, python
- Ambito
- api, devops
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100