-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix the handling of team project references * Add paginator service * Disable caching for scope properties * Use paginator * Add missing parameterset annotation * Fix pipeline handling * Improve ShouldProcess support * Fixes collection parameter handling * Validate release notes * Update release notes * Remove unused field * Update release notes
- Loading branch information
Showing
24 changed files
with
185 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Management.Automation; | ||
using System.Threading.Tasks; | ||
|
||
namespace TfsCmdlets.Services | ||
{ | ||
public interface IPaginator | ||
{ | ||
IEnumerable<T> Paginate<T>(Func<int, int, IEnumerable<T>> enumerable, int pageSize = 100); | ||
|
||
IEnumerable<T> Paginate<T>(Func<int, int, Task<IEnumerable<T>>> enumerable, string errorMessage, int pageSize = 100); | ||
|
||
// IEnumerable<T> Paginate<T>(Func<int, int, Task<List<T>>> enumerable, string errorMessage, int pageSize = 100); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.TeamFoundation.Core.WebApi; | ||
using TfsCmdlets.Models; | ||
|
||
namespace TfsCmdlets.Services.Impl | ||
{ | ||
[Export(typeof(IPaginator))] | ||
public class Paginator : IPaginator | ||
{ | ||
public IEnumerable<T> Paginate<T>(Func<int, int, Task<IEnumerable<T>>> enumerable, string errorMessage, int pageSize) | ||
{ | ||
var isReturning = true; | ||
var loop = 0; | ||
int items; | ||
|
||
while (isReturning) | ||
{ | ||
isReturning = false; | ||
items = 0; | ||
|
||
foreach (var result in enumerable(pageSize, loop++ * pageSize).GetResult(errorMessage)) | ||
{ | ||
items++; | ||
isReturning = true; | ||
yield return result; | ||
} | ||
|
||
isReturning = isReturning && (items == pageSize); | ||
} | ||
} | ||
|
||
public IEnumerable<T> Paginate<T>(Func<int, int, IEnumerable<T>> enumerable, int pageSize) | ||
{ | ||
var isReturning = true; | ||
var loop = 0; | ||
int items; | ||
|
||
while (isReturning) | ||
{ | ||
isReturning = false; | ||
items = 0; | ||
|
||
foreach (var result in enumerable(pageSize, loop++ * pageSize)) | ||
{ | ||
items++; | ||
isReturning = true; | ||
yield return result; | ||
} | ||
|
||
isReturning = isReturning && (items == pageSize); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# TfsCmdlets Release Notes | ||
|
||
## Version 2.3.1 (_07/Apr/2022_) | ||
|
||
This release brings a few minor fixes to Team cmdlets and to pipeline handling. No new features and/or cmdlets have been introduced in this version. | ||
|
||
## Fixes | ||
|
||
* `Get-TfsTeam` and `Get-TfsTeamProject` were limited to a maximum of 100 results. This has been fixed. Now they will return all results. | ||
* Under certain circumstances, `Get-TfsTeamProjectCollection` (and, by extension, Get-TfsOrganization) would throw an error with the message "_Invalid or non-existent Collection System.Object[]._" (fixes [#165](https://github.com/igoravl/TfsCmdlets/issues/165)) | ||
* Fixes a caching bug in the handling of the -Project parameter that could lead to the wrong project being returned. | ||
* Fixes pipelining bugs in several cmdlets (most noticeably `Get-TfsReposity`, which wouldn't work when connected to a pipeline). | ||
* Improves the readability of ShouldProcess (Confirm / WhatIf) output in several cmdlets. |
Oops, something went wrong.