DevMethod Logo

My thoughts on Cherry Pick in a TFVC project

Cherry Picking and D365FO

Cherry picking is a term used in version control systems to describe the act of choosing a subset of changes from a branch and applying them to another. In the context of TFVC, cherry picking is a manual process that involves identifying the changesets that contain the desired changes and then applying them to the target branch. This can be a time-consuming and error-prone process, especially when dealing with large or complex changesets.

TFVC is not entirely simple to use with a complex branching strategy and "Cherry picking" for several reasons. Potential problems and errors when "Cherry picking" a D365FO project in Azure DevOps with Team Foundation Version Control (TFVC) can be numerous.

For different reasons we as D365FnO developers and project leads need to implement this anyway and we need to be careful when doing this.

Introduction

"Cherry picking" refers to selectively choosing specific changes or commits from a version control system to apply to another branch. When using TFVC in Azure DevOps for a Dynamics 365 for Finance and Operations (D365FO) project, "Cherry picking" can potentially lead to several issues.

Code Conflicts

"Cherry picking" can introduce code conflicts, especially when changes are dependent on other code changes that have not been selected. This issue can affect system functionality or even cause build errors.

Inconsistent State of the Codebase

"Cherry picking" can result in an inconsistent state of the codebase, as it may leave out certain changes that were part of the original development sequence. These inconsistencies can make debugging and maintenance tasks more difficult.

Missing Dependencies

When "Cherry picking" changes, it is possible to miss dependencies that are required for the selected changes to function correctly. This can lead to unexpected behavior or system errors.

Complexity and Time Consumption

Cherry picking can be a complex and time-consuming process, especially when dealing with a large number of changes or complex code dependencies. This can lead to delays in the development process and increase the risk of errors.

Lack of Traceability

One of the critical advantages of version control systems is traceability. However, "Cherry picking" can disrupt this traceability, making it harder to understand the history and rationale behind specific changes. This can further lead to difficulties in debugging, code maintenance, and code reviews.

Merge Issues

Overuse of "Cherry picking" can lead to merge issues in the future. If the same change is applied to different branches via "Cherry picking," merging these branches later can lead to merge conflicts or unnecessary duplication.

Performance Degradation

"Cherry picking" can inadvertently result in performance degradation if related optimizations or performance-related changes are not included. This can negatively affect system response times and scalability.

Testing Challenges

"Cherry picking" can introduce testing challenges. Since only selected changes are applied, it may result in the software behaving differently than expected, complicating the testing process.

Incomplete Features

"Cherry picking" can also lead to incomplete features, as it may skip certain changes that are part of a larger feature. These missing parts can lead to system errors or incorrect behavior.

Conclusion

While Cherry picking" can be helpful in some scenarios, it should be used with caution. It is important to ensure comprehensive testing and review of "Cherry picked" changes to minimize potential issues. Code reviews, automated tests, and continuous integration practices can help mitigate the risks associated with "Cherry picking" in a D365FO project using Azure DevOps with TFVC.