Remapping in style

Published 28 April 05 12:30 PM | Adam Singer 

James introduced me to a neat trick recently with working folders. Oftentimes, I create a workspace and only want to map one team project to the local workspace root. Of course, I could use the UI, but that's not scriptable from a command file. I could also explicitly unmap the root and then remap. However, this requires the remap to indicate both workspace name and server name like so:

h workspace /new /noprompt /server:TfsCentral AdamWorkspace
h workfold /unmap $/
h workfold /map $/Project1 . /workspace:AdamWorkspace /server:TfsCentral

Instead of all this, we can simply remap over the current folder, 'automagically' deleting the old mapping. Moreover, if none of /map, /unmap, /cloak, /decloak are specified, the workfold command assumes /map. So, we could simply do this:

h workspace /new /noprompt /server:TfsCentral AdamWorkspace
h workfold $/Project1 .

Now, when I switch servers, I only have to update the server name in the workspace creation line of my command file. Thanks, James!

Filed under:

Comments

# Rob Caron's Blog said on May 9, 2005 5:14 AM:
Visual Studio Team System

If you’re installing Beta 2 using Virtual PC, you should learn to appreciate...
# jmanning said on June 8, 2005 5:03 PM:
This "remap" functionality is nothing more than implicitly deleting an existing mapping as you're adding a new mapping (pretty obvious, hopefully useful).

The one corner case that we specifically check for and disallow is if your new mapping would need to remove *2* different mappings in order to add the new mapping.

The error message you would get is something like the following: (yes, it really is this long - we wanted to be *very* specific to the user about why we're not doing the implicit remap we would normally do)


The requested mapping matches an existing mapping on server path ($/proj/foo to c:\foobaz) as well as a different mapping on local path ($/proj to c:\workfold\ws1) - remove one or both of these mappings before attempting to create this new mapping. This helps to prevent unintentionally destroying multiple existing mappings with a single command.
# James Manning's blog said on June 22, 2005 7:43 AM:
Adam Singer had pointed out the little helpful "remap" functionality we have in our command-line interface. ...
# Jay said on April 11, 2006 2:30 AM:
I am getting the error :- The requested mapping matches an existing mapping on server path ($/proj/foo to c:\foobaz) as well as a different mapping on local path ($/proj to c:\workfold\ws1) - remove one or both of these mappings before attempting to create this new mapping. This helps to prevent unintentionally destroying multiple existing mappings with a single command. and donot get it? can someone help me?

Thanks.

Jay
# Adam Singer said on April 11, 2006 9:24 AM:
Hi Jay-

I recommend checking out this forum thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=334975&SiteID=1

It sounds like there might be another workspace on your computer mapped to that local folder already.
New Comments to this post are disabled

About Adam Singer

Faster than a speeding batch file, stronger than a well coded C# library, Adam is often seen testing those dark, dank quagmires of features where few tread and even fewer return. And he does so with a signature chipper attitude not sold in stores.

Search

This Blog

Syndication

Page view tracker