Skip to content

'dict' object has no attribute 'ids' #502

Description

@HassanShahbaz

Hi i'm trying to list all the commit in a specific branch via python from azure devops but getting this error, 'dict' object has no attribute 'ids'. I'm using get_commits function here is my sample code.

import os
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
from git import Repo, GitCommandError

class AzureDevOpsGitManager:
    def __init__(self, organization, project, repo_name, pat):
        self.organization = organization
        self.project = project
        self.repo_name = repo_name
        self.credentials = BasicAuthentication('', pat)
        self.connection = Connection(base_url=f'https://dev.azure.com/{organization}', creds=self.credentials)
        self.git_client = self.connection.clients.get_git_client()
      
    def list_commits(self, branch_name='main'):
        commits = self.git_client.get_commits(repository_id=self.repo_name, project=self.project_name, search_criteria={'itemVersion': {'version': branch_name}})
        return [(commit.commit_id, commit.author.name, commit.comment) for commit in commits]

Any idea why i'm getting the above error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions