Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HassanShahbaz opened this issue Jul 10, 2024 · 0 comments
Open

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

HassanShahbaz opened this issue Jul 10, 2024 · 0 comments

Comments

@HassanShahbaz
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant