Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 6, 2025

This PR adds support for retrieving Git repositories from the Recycle Bin to the Get-TfsGitRepository cmdlet by introducing a new -IncludeRecycleBin parameter.

Changes Made

Core Implementation

  • Added IncludeRecycleBin SwitchParameter to the Get-TfsGitRepository cmdlet
  • Enhanced controller logic to call GetRecycleBinRepositoriesAsync() when the parameter is specified
  • Integrated recycle bin search into all existing repository lookup patterns:
    • Exact name matching
    • GUID-based lookup
    • Wildcard pattern matching
    • Multiple repository inputs

API Integration

The implementation leverages the existing GitHttpClient.GetRecycleBinRepositoriesAsync() method, which calls the Azure DevOps REST API endpoint:

GET https://dev.azure.com/{organization}/{project}/_apis/git/recycleBin/repositories?api-version=7.1

Usage Examples

Get all repositories including those in the recycle bin:

Get-TfsGitRepository -Repository '*' -IncludeRecycleBin -Project 'MyProject'

Find a specific deleted repository:

Get-TfsGitRepository -Repository 'DeletedRepo' -IncludeRecycleBin -Project 'MyProject'

Find deleted repositories matching a pattern:

Get-TfsGitRepository -Repository 'Old*' -IncludeRecycleBin -Project 'MyProject'

Output Types

When -IncludeRecycleBin is used, the cmdlet returns:

  • GitRepository objects for active repositories
  • GitDeletedRepository objects for deleted repositories from the recycle bin

The GitDeletedRepository objects include properties like Id, Name, ProjectReference, DeletedBy, CreatedDate, and DeletedDate.

Testing and Documentation

  • Comprehensive test coverage for all parameter combinations and edge cases
  • Complete documentation with usage examples and API references
  • Backward compatibility maintained - existing functionality unchanged when parameter not used

Key Features

  • Efficient implementation: Single API call for recycle bin data per repository search
  • Wildcard support: Full pattern matching for deleted repositories
  • Parameter compatibility: Works seamlessly with existing -IncludeParent and -Default parameters
  • Multiple input support: Handles arrays of repository names/patterns
  • Error handling: Graceful handling of API failures and missing repositories

Fixes #241.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://www.microsoft.com:80/pkiops/crl/Microsoft%20Identity%20Verification%20Root%20Certificate%20Authority%202020.crl
    • Triggering command: dotnet build CSharp/TfsCmdlets.sln (http block)
  • http://www.microsoft.com:80/pkiops/crl/Microsoft%20Public%20RSA%20Timestamping%20CA%202020.crl
    • Triggering command: dotnet build CSharp/TfsCmdlets.sln (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 6, 2025 03:24
…itory

Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com>
Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com>
Copilot AI changed the title [WIP] List repos in the Recycle Bin Add support for listing Git repositories in the Recycle Bin Jun 6, 2025
Copilot AI requested a review from igoravl June 6, 2025 03:28
Copilot finished work on behalf of igoravl June 6, 2025 03:28
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

Successfully merging this pull request may close these issues.

List repos in the Recycle Bin

2 participants