tf diff on server items shows local changes not server - tfs

I am running the TF Diff command to get differences between two branches. I run the following command:
tf difference $/myVersionControl/Branch1 $/myVersionControl/Branch2 -recursive
The only differences that show up are the ones in the working directory and only the top level directory. its almost like it does not recursively look inside. What am I doing wrong here? I can get a list of all the diffs if I do it from Team Explorer just fine. I am assuming Team Explorer is using TF Diff under the covers but I could be wrong.
I am using TFS 2008.
If there is a powershell equivalent - that would be perfect because i want to pipe the output and have a few more things to do with these changes.

tf folderdiff $/Branch1/ $/Branch2/ -recursive > output.txt
To use the difference command, you must have the Read permission for all specified items set to Allow.

Related

Can't run some TFS commands

I am trying to change the owner of a TFS Project Collection with this command:
tf workspaces /collection:http://appdev:8080/tfs/applications applications;OLD.OWNER /newowner:NEW.OWNER
But I am getting this error:
Unrecognized command option 'newowner`
I also tried with workspace instead of workspaces as suggested by Giulio, but with this error:
The workspace applications;OLD.OWNER does not exist. Please specify an existing workspace or /new to create one.
Also tried adding a /computer:COMPUTERNAME switch, but this gives the same error as the previous attempt.
Interestingly, when I try querying all workspaces with
tf workspaces /collection:http://appdev:8080/tfs
I get:
Unable to retrieve the registration information for 'ISCCProvider'
And the same error is produced if I specify the computer
I am running this command from the Developer Command Prompt for VS2015, but not on the TFS server itself (I am running it from my machine).
I am the owner of all project collections.
I am able to call tf workspaces without any issue, and I can also call tf workspaces /collection:http://appdev:8080/tfs/applications with the expected results.
What could possibly be going wrong here?
When you typing
tf workspaces /collection:http://appdev:8080/tfs
You will definitely get this error
Unable to retrieve the registration information for 'ISCCProvider'
Since this command tf workspaces it's collection level not server level, your address (http://appdev:8080/tfs) is server url, you just need to add your collection info of the url such as http://appdev:8080/tfs/applications The error will disappear.
In your case :
First typing
tf workspaces /collection:http://appdev:8080/tfs/applications
This will list all workspaces belongs to you on your computer.
Then typing
tf workspace/collection:http://appdev:8080/tfs/applications workspacename/newowner:xxx
The workspace name is the one which you want to change the owner.
You can get the info from the first command. You don't have to add
the older owner name and option, just need to add new owner
name.
Finally you cloud also typing
tf workspaces /collection:http://appdev:8080/tfs/applications
again, you will see
the changed workspace will not list any more. This is make
sense, since the owner is changed and the workspace not longer
belongs to you.
Mind the spelling: you want tf workspace but you typed tf workspaces which is a different command.
tf workspace and tf workspaces command is used to set/configure the workspaces, and the command used to change the owner of the workspace is:
tf workspace /collection:http://appdev:8080/tfs/collectionname workspacename;oldowner /newowner:newowner
You cannot use this command to change the settings for project collection.

TFS File comparison report tool

I often compare DEV and MAIN branches and would like to run a report to show these results. I manually run the compare and copy and past the results into excel. Is there a more efficient way to do this?
You can use the command line tool tf.exe to compare a visual representation of the differences between files in two server folders, in a server folder and a local folder, or in two local folders:
tf folderdiff sourcePath targetPath /recursive [/noprompt]
/noprompt option means tf folderdiff runs without displaying user
interface. The output is displayed in the Command Prompt window
instead.

TFS shelveset migration from one branch to another

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
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.
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.
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.
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
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.
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

TFS Check In History

I am trying to find out the most recent branch/merge for my project (I'm migrating to a new server and want to define a starting changeset). Is there a way for me to either query the repository database or the command line tools to find out the most recent branch/merge?
You can find the history of a current folder by using the history command.
Lets assume your entire project resides in a directory called 'project'. Using the below command will give you a list of all the changesets that impacted that directory or any of its children.
tf history project /r

Phantom TFS workspace will not let me map to another workspace?

I type this command: tf workspaces into a command line and it tells me there are no workspaces on the machine. I then try the same command on the server, nothing. So I go into Visual Studio 2010 and create a new workspace and try to map the TFS path to my local path. I then get an error that the mapping already exists in another workspace. But I cannot find that workspace on my local or on the tfs server. Any ideas?
You can run tf workspaces /remove:* to clear out your local cache of workspaces. See this link for more details.
I know this is an old question, but I just came across this issue on a Linux machine running TEE (Team Explorer Everywhere). Running "tf workspaces -remove:*" didn't work, because it said there were no workspaces in the cache.
The user was trying to create a new workspace, which worked, but when he tried to map folders, it told him it didn't exist.
When he ran "tf workspaces" on the machine and when I looked in TFS Sidekicks on the server itself, it didn't show any workspaces for him on the Linux box.
If he tried to create the workspace again, it told him that it already existed, but every time he tried to map, he was told it didn't.
We could see the workspace from the tf command line if I did "tf workspaces /owner:", and it required me to run "tf workspace /delete ;" from the command line to get rid of it.
Once we did that, he was able to create it again and everything worked properly.
No idea why that happened, but figured I'd post my answer here just in case someone else comes across a similar issue in the future.

Resources