views:

193

answers:

3

I have some version of code on my machine. I want to set up a second machine with the same version of code so I can pull down a shelveset based off this version. However, I didn't write down the day/time I last did get latest on my machine.

To get the right version, I need to know when exactly I last did 'get latest' on my machine. I'm sure there must be some way to do this, maybe on the command line. Does anyone know?

A: 

When you pull down a shelveset it will set the workspace you pull it down to to the same state of original workspace that created the shelveset, including rolling back versions of the files at that point in time so that you have consistency.

All you need to do on machine #2 is do a get latest, then pull down the shelveset and work on it.

If you just want to find out the changeset the shelve was against then at the unshelve dialog, select the shelveset you are interested in and look at it's details, right click one of the files and select properties. In the window that comes up you should be able to see the shelveset's revision number

Hope that helps

Richard Banks
This isn't true -- it will only revert the files in the shelveset to the appropriate version, not the rest of your workspace. You'll probably end up with an inconsistent state.
Richard Berg
I haven't tried this but I thought it didn't work that way, which is why I posed the question.
TheSean
I thought it reset the workspace. Bummer, now I'll have to recheck what I thought I knew.
Richard Banks
A: 

You could just copy the 'good' tree onto the new machine.

DaveE
You cannot unshelve into a random directory. Even if its contents happen to match a "real" workspace perfectly, the server doesn't know that.
Richard Berg
+3  A: 

Run this from inside the workspace in question:

tf history $/ -r -version:W -stopafter:1

This will tell you the highest changeset # that has been downloaded to your workspace. So long as your most recent Get operation was a full "Get Latest" (no path scope, no complex versionspec), that's all the info you need. Simply run tf get -version:1234 (replacing the version # with the changeset number TFS provides) in the new workspace to bring them in sync. Of course, you need to ensure the workspace mappings are comparable, etc...

If the assumption above don't hold and your workspace is in a more complicated state, the easiest way to replicate it is with labels:

# run in old workspace
tf label MyWorkspaceVersion $/ -r -version:W

# run in new workspace
tf get -version:LMyWorkspaceVersion
Richard Berg
Thanks, this sounds like it will help me out a lot. I'll try it out next time I need to do this.
TheSean