What is the purpose of a shelveset?

前提是你 提交于 2019-12-03 05:11:29
Kelly Davis

From a process perspective (in an agile shop) the primary use is to ensure your code builds with the existing code without breaking the build on your integration branch for the rest of your team. The items noted above will help you accomplish this task.

In short: never check anything in if it does not build correctly. Shelf your code to ensure it works and does not break the build before checking it in. If you do break the build for your team, your nightly builds (if you have them) won't work, so your testers will not have the new code base to work with.

Note: your code might be buggy at first but that's ok, just don't break the build. If your code is not mature enough to be tested (breaks something or perhaps the entire app), ensure your code is inactive in the application. There are lots of tricks for doing this from simply commenting the code out so you can check it in to adding an exception of some kind to prevent the code from running unless you set a variable during your debug. I am sure there are million other things you can do as well.

In my experience shelvesets are typically used for 3 purposes:

  1. Switching Tasks before I'm ready to Check-In
  2. Getting help from colleagues on code that isn't working
  3. Code Reviews

When you create a shelveset you have a checkbox to choose whether you want to undo your pending changes at the same time or not.

For #1, I would want to check the box to undo my changes, as the entire purpose of shelving is to get a clean local workspace to start on the new task.

For #2, I would probably not undo my changes, as after the colleague has looked at my code and helped me I will want to continue working on those changes.

For #3 this is only applicable if the code review workflow is pre-checkin, in that case you would typically undo your pending changes so you can start working on the next item while waiting for the review and not comingling the changes.

Just for reference, this MSDN link provides the usage of shelvesets as:

  • Interruption: You have pending changes that are not ready for check in, but you need to work on a different task.
  • Collaboration: You have pending changes that are not ready for check in but you need to share them with another team member.
  • Code Review: You want another team member to perform a code review of your pending changes.
  • Private Build: Before you check in your changes, you can use your automated build system to build and test your code.
  • Backup: You have work in progress that you cannot finish now so you want a backup copy that is stored on your server and available to other team members who might need to access it.
  • Handoff: You have work in progress that you want to hand off to another team member.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!