I am currently on a project with a large development team. Some of the developers are learning how to code X++, so one feature can turn into six check ins. Therefore, I needed a way to review all non-promoted changes before I rolled out the next release. I can check using Visual Studio with four clicks, but I have to check twenty or so branches. My case may be an extreme example because every developer has their own branch; however, the resulting script is very useful. Anyways, there are ways to check what can be promoted using the TF tool:
For some time, I had a text document with twenty of these commands that I would run…the format of the data returned was very much from the DOS ages. This did not make my life any easier. So I enhanced my solution, I took the output of that command and parsed it with PowerShell and combined result sets to have a single view and export to CSV for a single view of all possible changesets available for promotion. It also includes a URL to the changeset in Azure DevOps.
Get-DevOpsCandidates PowerShell Cmdlet
Download the PowerShell command from GitHub then import the function:
List the changesets which can be merged from dev branch 1 to trunk:
Checking Multiple Branches at the Same Time
Check all dev branches for merge candidates and save the output to CSV for filtering/sorting.
Check out my other work on GitHub.com/dodiggitydag.
Hi.
In my projects, the developer couldn’t create a new branch for his own feature. They should use common DEV branch to checking their code. Then merge to the MAIN. QA check that. Then QA provides a green light for the feature and Dev should merge it to RELEASE branch.
This is how it works on my projects. Only one-way is possible DEV –> MAIN –> RELEASE
To avoid mistakes on code merge (Labels duplicates, for instance), I build a small CI Build Server that triggered on every dev check-in.
Hi Valery,
I think you’ve hit upon the best method. After having experienced projects with many branches, and others with few branches certainly the fewer the branches the better. I think your approach is the best method, especially with CI, or even gated check-ins to prevent build failures.
Cheers!
Dag III
I’m running into an issue however where the $p.Start() call is creating an instance of tf.exe that doesn’t seem to ever exit successfully. I did some digging and I think it may be related to a bug in the .NET libraries where a process with output redirection will keep a child process open indefinitely. I’ve linked to the bug description below. Is there another way I can tackle this in Powershell to work around the bug?
https://github.com/dotnet/runtime/issues/29232
Hi Brad,
I’m unaware of a work around without digging. I suggest running it manually and reviewing the output, sometimes the process hangs because the software needs to be updated/reinstalled or there is a lock on a file. Speaking of which, try running the PS script as Administrator.
Dag III