Sunday, April 19, 2015

TFS FEATURE: SHELVESET – A BOON FOR DEVELOPERS

I would like to share this with developers: It’s pretty useful feature and I think it will be beneficial to all if our team starts using it. Go through this email and let me know if it’s worth sharing or not.
 What is Shelve?
Shelving is a way of saving all of the changes on your box without checking in. The changes are persisted on the server. At any later time you or any of your team-mates can “unshelve” them back onto any one of your machines and carry on with their work.
 It’s also great for review purposes. One can drop an email with the change description and name of the shelveset. People on the team can then view the shelveset and give feedback.
 Advantages:
 Shelving has many uses. The main ones are:
  1.  Context Switching: Saving the work on your current task so you can switch to another high priority task. Say you’re working on a new feature, minding your own business, when your boss runs in and says “Ahhh! Bug Bug Bug!” and you have to drop your current changes on the feature and go fix the bug. You can shelve your work on the feature, fix the bug, then come back and unshelve to work on your changes later.


  1. Sharing Changesets: If you want to share a changeset of code without checking it in, you can make it easy for others to access by shelving it. This could be used when you are passing an incomplete task to someone else or if you have some sort of testing code you would never EVER check in that someone else needed to run.Using this for reviews, it is a very good idea.

  1. Saving your progress: While you’re working on a complex feature, you may find yourself at a ‘good point’ where you would like to save your progress. This is an ideal time to shelve your code. Say you are making drastic changes in aspx page with jquery/javascript/CSS/ HTML to fix rendering bugs. Usually you bang on it, iterating every possible kludge you can think up until it looks right. However, once it looks right you may want to try and go back in to cleanup your markup so that someone else may be able to understand what you did before you check it in. In this case, you can shelve the code when everything renders right, then you are free to go and refactor your markup, knowing that if you accidentally break it again, you can always go back and get your changeset.

  1. Stop tracking the changes: We usually have scenarios in which we fix the bug by making changes in the code, and it takes a while for that bug to get tagged in a release. So instead of maintaining the code till the time it gets tagged, we can shelve the changes with out worrying to note down the changes for each bug respectively.

  1. Manage Simultaneous work: We tend to have multiple tasks (bugs, Change request, User Story) in which we have to make changes in same file on numerous occasions. There is very common possibility of a scenario where  we are done with the changes long before this tasks gets tagged. After a time, it gets really difficult to differentiate the changes of tasks, bugs, CR, US in the same code. Hence, here shelving comes to the rescue. Focus on one task at a time, after completing that task, shelve those changes and don’t preserve that changes. Once your changes pertaining to one task is shelved, then only move towards other task and shelve those changes. Hence in this way one will be able to easily identify the changes pertaining to each tasks seperately which will avoid any confusion.



Shelve your changes

 Tip
In either Solution Explorer or Source Control Explorer, you can shelve a specific subset of the files that you are working with: select them, open their context menu, and then choose Shelve Pending Changes. The Pending Changes page appears, ready to shelve only the files you selected.

To shelve your changes
  1. In Team Explorer, chooseHome, and then choose Pending Changes.
  2. In thePending Changes page, make sure that the changes you want to shelve are listed in the Included Changes  You can drag files between Included Changes and Excluded Changes (Keyboard shortcut: open the context menu of an item, and then choose Include or Exclude.
  3. Choose theShelve
  4. Type a name for the shelveset.
  5. (Optional) Select either of the following check boxes:
    • Preserve pending change locallyBy default, this check box is selected. When this check box is selected, your pending changes (including the comment and the Related Work Items list) are not removed from your workspace. If you want to clean your workspace to work on another task, you should clear this check box.
    • Evaluate Policies and check-in notes before shelvingWhen you select this check box, all check-in policies are evaluated before the shelveset is created. For more information about check-in policies, seeSet and Enforce Quality Gates.
  6. Choose theShelve

Following is the screenshot for reference:

1

Find a shelveset

To find a shelveset
  1. In Team Explorer, chooseHome, and then choose Pending Changes.
  2. Choose theActions link, and then choose Find Shelvesets.
  3. On theFind Shelvesets page, enter the name or alias of a team project team member in the box, and then choose the Enter

2

 Tip
If you don’t know the name of the owner, you can type * to list shelvesets for all users.

  1. A list of shelvesets appears in theResults  You can type a filter to reduce the size of the list.

Currently there are 23 shelvesets in developer’s name:
3


View and work with a shelveset

After you have a list of shelvesets (explained in “To find a shelveset”) in the Find Shelvesets page, double-click/right click and select the shelveset to view it.
4

The Shelveset Details page appears.
5
  • You can toggle between list and tree view from theActions
  • To get more information about a change to a file, open its context menu, and then chooseOpenView History, or one of the Compare
  • ChooseUnshelve Changes if you want to retrieve the changes in the shelveset into your workspace:
    1. For any file changes that you do not want to unshelve, open the context menu of the file, and then chooseExclude.
    2. If you want to delete the shelveset, clear thePreserve shelveset on server check box.
    3. If you do not want to restore the work item list and check-in notes that are stored in the shelveset clear theRestore work items and check-in notes check box.
    4. Choose theUnshelve
      If there are conflicts between changes in the shelveset and the file versions in your workspace, the system will prompt you to resolve them.
  • ChooseDelete Shelveset if you want to delete the shelveset.
 Caution
Be sure you do not need any of the work stored in a shelveset before you delete it. There is no way to recover a deleted shelveset.


No comments:

Post a Comment