Do shelvesets save all workspace file versions?  
Author Message
WXS123





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

When you shelve does it save the current version information for all files in your workspace, so that you can be sure to get back to where you were when you shelved

The typical example is I am working on some files but need to work on a different issue, I shelve my current changes, then do a get latest to make sure I'm in sync, make my new changes, checkin then unshelve the code I was working on previously.

The question is would my workspace be rolled back to the point prior to me doing get latest or would I potentially have files out of sync at that point (sync I was editing the files I shelved possibly related to early versions of other files in my workspace.)

I don't think I hit a scenario like this yet, wondering if that is because it does this, or I just haven't hit the issue

Thanks



Visual Studio Team System41  
 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

No, it only saves the workspace version of the files actually being shelved. The following two situations are equivalent:
  1. shelve, get latest, unshelve
  2. shelve, unshelve, get latest
(assuming no simultaneous checkins)

 
 
Martin Woodward





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

Hi,

Only the files in the shelveset would get rolled back to the state they were in at the point of shelving all the other files in your workspace remain untouched. You can then test those files in relation to the rest of the code base. If you do a "Get Latest" on your code - it will merge the changes in the latest version with the files you currently have checked out (i.e. those files you just unshelved).

The thing that sometimes catches me out is that when I unshelve I have to explicity do a "Get Latest" to force it to merge the files in my shelveset with the latest version on the server (or even the latest version that was in my workspace). For some reason my brain thinks that this would automatically happen, even though it makes total sense that it doesn't.

Hope that helps,

Martin.




 
 
WXS123





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

I think you guys should think about a feature that can support saving the workspace with the shelveset, as often times I was working on a specific set of files I need to go back to. There probably isn't a reasonable way to use the existing workspaces to do this since there is no copy my workspace versions command.

I think often times that is what I user would expect from a shelve since if it is an interrupt case they would want to go back to where they were for their shelve. At the very least it would be nice to have this as an option on the unshelve window to restore your workspace back to the time when you shelved.


 
 
WXS123





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

Yes some of the rollback scenarios for shelvesets can get kind of funky. We found out if you unshelved and undo changes and unshelve again, if there were adds in the shelve you get all sorts of conflict warnings... undo isn't really undo if it's an add. Sort of expect that but just odd when thinking about shelvesets.


 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Do shelvesets save all workspace file versions? Top

There are a couple ways to do this. If there are only a few files you care about saving, you can just pend edits on them before shelving -- unlike Checkin, Shelve doesn't check whether the file contents has actually changed.

The most robust way is to use labels. tf label labelName $/ /r /version:W will save the state of your workspace into the label. Then you'd run tf get /version:LlabelName after unshelving.

Integrating this into the shelveset UI would be an interesting feature, I'll add it to the list.