28

I have to migrate the shelveset created in one branch say "development" to another say "release". so that I can directly merge the shelveset then to release which was created for development branch.

the command I have used is:

tfpt unshelve "shelveset name" /migrate /source:"$...development" /target:"$...Release"

it is showing this error:

unable to determine the workspace

T.S.
  • 18,195
  • 11
  • 58
  • 78
superman
  • 377
  • 1
  • 5
  • 12
  • for me it was that I had two Powertools version installed. I had to uninstall the old one so only the newest one (2012) was left. Also the powertools version doesn't reference the TFS version (as we are using 2010) – Boris Callens Apr 18 '14 at 13:33

6 Answers6

12

Your location from where you launch the command must be from within your workspace. E.g. c:\workspaces\project\development if that's where your source is located.

T.S.
  • 18,195
  • 11
  • 58
  • 78
Krimson
  • 762
  • 6
  • 25
3

I guess you question is: How can I get the job done without this error occurring?. In that case, make sure both branches are mapped to your local system and a latest version of your source code in you did a get-latest-version.

That should prevent the error from happening, because the paths then both contain information about the workspace used for the mapping.

kroonwijk
  • 8,340
  • 3
  • 31
  • 52
1

I ran into the same issue today. After checking the items below I got it working:

  • Have only one Powertools installed.
  • Run the command from a Developer Command Prompt
  • Run the command from the folder that is mapped to your target workspace.

I had to uninstall v. 2010 so only v. 2012 remained. The version numbers doesn't seem to reference your TFS version.
To check if you are at the correct folder, you can run tf workspace.
In the window that pops up find the workspace that you want to target and check in column Local Folder. Make sure you are in that folder.

Boris Callens
  • 90,659
  • 85
  • 207
  • 305
  • I concur. I have read many posts on this and have tried the various fixes but I am convinced that it is multiple existing versions of TFPT even existing on your system (regardless of how you reference them) that causes this error to occur, and because of that I strongly suspect this is a bug in the Power Tools code. – paulyphonic Aug 02 '14 at 01:00
0

I spent good amount of time to get this done and I had few issues to overcome and one of these in fact was

unable to determine the workspace

This particular issue was solved by running the command from source branch root folder. This is contrary to some answers here and on SO in general where they say to use "target" branch - no, use "source":

cd [your !!source!! branch root]
tfpt unshelve /migrate /source:"$/MyCollection/Development/Maint1.1" /target:"$/MyCollection/Development/Maint1.2" "myShelveset;UserName"

Second issue appeared after this. Seem that it couldn't connect to TFS server. what I realized, I have multiple VS installed and connected to different TFS servers. I was using VS12 and I had workspace and server connection. But I didn't realize that same connection needs to be replicated in VS13 for TFPT2013 to work. It connects to same server and workspace.

I also tried doing it using TFPT2015 but I installed it and it didn't install TFPT.exe hence it was useless. So I tried from TFPT2013 to TFS2015 and it worked for this particular command. I wonder, why not, if VS12/13 works fine against TFS2015?

To summarize

  • Use CMD or DevCMD - doesn't matter
  • run from source branch root folder
  • verify Team Explorer Server connection
  • TF Power Tools 2013 work against TFS v15, at least migrate option works
T.S.
  • 18,195
  • 11
  • 58
  • 78
  • I'm running the same command from the source branch, and still get the error. I'm using TFPT 2015, with TFS 2017 on the server - could that be the issue? – ryanwebjackson Jan 02 '19 at 21:14
  • @ryanwebjackson Make sure, both of your branches are mapped in workspace(s) – T.S. Jan 02 '19 at 21:28
  • @ryanwebjackson I think so. Basically, TFS can't work against not-mapped code. I understand it like this - *"unable to determine the workspace"* tells you that it can't find this *"$/collection/. . . "* mapped to some directory in some workspace. You want to map both branches, get latest and then run your command – T.S. Jan 02 '19 at 22:53
  • I think I just can't run the command then, because one of my workspaces is too high in the directory structure, but I'm not going to delete it, just for this action. Thanks for the feedback though, I honestly appreciate it. – ryanwebjackson Jan 02 '19 at 22:59
  • @ryanwebjackson This is where I am not getting... *"one of my workspaces is to high in the directory structure"*. Worspace can't be high or low. You can map as many branches or their parts in one workspace. Even if you talking about branches - this is also not matter. On can be `$/xxx/x/x/x/x/x` and another `$/y/y` – T.S. Jan 02 '19 at 23:02
  • A workspace is mapped to a directory on the server, and in our case, the convention is to map at the collection level - this is preventing me from taking the action. I am choosing to work-around this now by manually copying the changes and comparing. – ryanwebjackson Jan 02 '19 at 23:14
  • @ryanwebjackson It should take 10 min to try mapping 2 workspaces whatever collections they mapped to. get latest, Run command and undo, if you don't like the result. But it would be interesting exercise. I think, it should work as long as directory is mapped to a branch via some workspace – T.S. Jan 02 '19 at 23:21
0

My first answer explains how to have this done properly using TFPT. In this answer, I want to explain how to do it without TFPT.

Every developer should have multiple workspaces. Because we work on multiple issues simultaneously and we don't want to mix it up. so, you work on one issue in WS1 and another issue in WS2. So, if you unshelve your shelveset in a different workspace, this will do that as well. Because your shelveset can't point to 2 different locations in the same workspace. But in different workspace it will unshelve to a location mapped in that workspace.

T.S.
  • 18,195
  • 11
  • 58
  • 78
-1

I ran into the same problem as Boris Callens. I had installed the TF Power Tools for VS2012 and VS2013. When runing the tfpt.exe command in command promt I always had the error message "unable to determine the workspace". This is because I was using the VS 2012 power tools with TFS 2013. So I had to change the Path to the Power Tools in the System Environment Variable "TFSPowerToolDir" to point to the Power Tools for VS2013.

You can find the version number running: tfpt.exe /? TF Power Tools version