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

fix(azure-provider): handle renamed files as new files #1452

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

med8bra
Copy link
Contributor

@med8bra med8bra commented Jan 13, 2025

User description

This fixes a bug when azure-provider tries to fetch original content of a renamed file and fails since the file doesn't exist in base yet. Also handles case when diff_type includes multiple actions as edit, rename.

This can be improved to fetch the actual old content using the old path before renaming, but IMO for azure devops since its dying anyway, this fix should be enough.


PR Type

Bug fix


Description

  • Fixed handling of renamed files in Azure DevOps provider.

  • Addressed cases where diff_type includes multiple actions like edit, rename.

  • Ensured renamed files are treated as new files for content fetching.


Changes walkthrough 📝

Relevant files
Bug fix
azuredevops_provider.py
Fix handling of renamed files in diff processing                 

pr_agent/git_providers/azuredevops_provider.py

  • Updated logic to handle rename in diff_type.
  • Treated renamed files as new files for content fetching.
  • Adjusted conditions for determining file edit type.
  • +2/-2     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    This fixes a bug when azure-provider tries to fetch original content of a renamed file and fails since the file doesn't exist in base yet.
    Also handles case when `diff_type` includes multiple actions as `edit, rename`.
    
    This can be improved to fetch the actual old content using the old path before renaming, but IMO for azure devops since its dying anyway, this fix should be enough.
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🏅 Score: 95
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Edge Case

    Verify that the handling of multiple diff types (e.g. 'edit, rename') works correctly in all scenarios, especially when the order of actions varies

    elif "rename" in diff_types[file]: # diff_type can be `rename` | `edit, rename`
        edit_type = EDIT_TYPE.RENAMED

    @mrT23
    Copy link
    Collaborator

    mrT23 commented Jan 14, 2025

    cool

    @mrT23 mrT23 merged commit 5daf8e0 into qodo-ai:main Jan 14, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants