Visual Source Safe Branch - Linked to Wrong Branch - visual-studio

OK... I know, I know... Visual Source Safe is terrible and I shouldn't be using it. But at this point I have no choice, my company is looking to move from it by the end of the year, but for now I have to work with what I have :(
So... I have a VSS Database with a branch representing released versions and one for the main branch...
$/
+ MyApplication
+ MyApplication4042
+ MyApplication4101
+ MyApplication4103
+ MyApplication4104
+ MyApplication4105
The problem I have is that I get the latest version of MyApplication4105, then go into Visual Studio to edit it. However when I start editing one of the files it pulls down the latest copy of that file from MyApplication branch instead, and when I make a change to a file I pulled down from the MyApplication4105 branch then book it back, it books it back to the MyApplication branch.
I've also noticed that if I have the copy of the file from MyApplication branch booked out it won't let me book out the one from MyApplication4105 branch.
Basically the Solution in MyApplication4105 branch is looking to the wrong branch for it's source control.
I'm sure I've had this problem before (possibly in the other branches of this project) and have solved it before... but I really can't find how to do it this time.
I have opened both the solution and the project files (.sln and .csproj) in notepad and tried to understand the source control parts of those and see if they are pointing to a particular branch, I've also compared them to the branches that are working correctly and can't see anything different that might be the cause.
So I know I would be better off with different source control... but while I'm stuck with this, does anyone have experience of this and know how to stop my 4105 branch being linked to the main branch.

I have finally worked this out.
Confusingly...
In VS I right clicked and chose 'Open Folder in File Explorer' and it went to my local copy of the correct branch
After getting the latest version through VSS tools the classes in each project were from the correct branch
HOWEVER getting the latest version from VS and the view of what was already checked out was coming from the incorrect branch.
I knew changes to the solution were checking in to the right branch, so with the full solution pulled down to my machine, I removed all the projects until the solution was empty. Then one by one I added them back.
After doing this everything links to the correct branch!
So somewhere (that I could not locate opening the solution/projects in notepad) the projects were mixed up which branch they had come from. Removing them from the solution and adding them back pointed them all back at the right branch.

Related

TFS - Make a child branch the main branch and abandon original parent

Somehow, my Visual Studio project got very much messed up. The source code was good, but things were messed up in some of the configuration files. After hours of fighting with it, I found an earlier changeset (changeset 20) that compiled and ran fine, albeit without the latest changes (I was up to changeset 25 by now).
I then performed the following steps:
I retrieved a copy of changeset 20 into a new temporary workspace.
I used WinMerge to manually merge the latest source code changes into the changeset 20 code that was in my temp workspace.
I branched my main branch (called MainBranch) in TFS to a new branch called TempBranch.
I manually copied my merged files (from step 2) from the temp workspace into the main workspace for TempBranch.
I checked the merged code into TempBranch.
My Heirarchy looks like this now:
So, now, TempBranch has all the latest "good" code, and none of the corrupt configuration files. MainBranch has the bad configuration files.
So now that TempBranch is exactly how I want it, and it's what I want to base all further development on, what should I do at this point, so that MainBranch is basically identical to TempBranch?
I'm worried that if I try to merge the branches, it will try to merge the bad config files in MainBranch with the good ones in TempBranch. I want to make sure that for all differences in the two branches, the TempBranch version "wins".
You can try to merge from TempBranch to MainBranch, and take source branch if there are conflicts.
If the history is not important in MainBranch, you can reparent the TempBranch, and choose No parent. Then there is no hierarchy between TempBranch and MainBranch, you can work on TempBranch.

When merging changes in the MSVS2013 IDE, is there a log of what occurred?

I pressed Alt-E which I mistakenly thought was Merge Changes In Merge Tool, however, that was actually Keep Local Version. Is there a way to go back? Is there a way to find out what was merged, as in what file? Ugh! :(
I have completely stopped working in case I erase something of importance.
I'm using MSVS 2013 Professional.
Here's another possible approach.
If you know what version of the code you started with before you started making your current batch of changes, you can grab a copy of your local workspace files. Then Undo all your Pending Changes. Then delete all the files in your local workspace (in Windows explorer). Then do a Get Specific Version to get back the old version of the files from where you started, then copy-paste in your updated files from your backup copy. Then do a Get Latest. This should retrigger the Merge process.
I don't know a great answer to this problem, but I do know one thing you can do (I hope you don't have a massive amount of pending changes, or this will get tedious).
The problem is that TFS thinks you have now merged the server changes (other devs changes) into your workspace, even though you told it to basically toss them. If you try to check-in now it will blow away other developers changes in TFS.
What you can do is go through each file in your pending changes window, and do a Compare With Latest Version. This will show you the differences between your local file, and the file in TFS. You will notice two types of differences:
the changes you made which you can just skip past.
Changes that other devs made and are on the server, these differences will show up as though you have deleted/undone that code locally
For the changes that other devs made, you will have to manually reapply them in your local workspace before you check-in.

Removing soltuion items from TFS2010 and "action caused a check out of the file(s)..." message

My solution structure looks something like this:
MySolution
FirstProject
SecondProject
SolutionFolder1
SolutionFolder2
SolutionItem1.txt
SolutionItem2.txt
Then there are two workspaces with
this solution at the same version
used by two users on different
computers.
A solution item is removed in the first workspace and the change is checked in into TFS.
In the second workspace the latest version is get from the TFS (the workspace is without local modifications and no files are checked out). Visual Studio displays this message:
Your action caused a check out of the
file(s) C:\MySolution \MySolution.sln,
and a new version from source control
has been loaded in the development
environment.
Now, there are two items in pending changes in the second workspace: solution file is checked out and the solution item is deleted. After undoing these changes and getting latest version, they appear again. These conflicts are resolved only during checkin which is a little bit confusing.
Is there a way how to get rid of this TFS oddity? Thanks.
I cannot find any answer but there is a workaround. Solution probably is not the best place to store complex folder hierarchies with a lot of files. When these folders and files are moved to own VS project then everything works well.

How to Merge Select TFS Changesets into My Workspace without All Previous Changesets Included

I am working on a project with another developer. We are in the process of a major upgrade with lots of breaking changes. The software we are working on is an AddOn to a product, and we are upgrading to work with a new version of the product. He has checked in some breaking changes that will not run in my environment yet because I am still running on the old version of the product. I have checked in some changes on top of those. Is there any way I can retrieve the code such that it includes only the changes up to the point before the breaking changes and also include only my changes after that in my workspace?
If I had not done a "get latest" I would be OK now because I made the changes on my machine so I would have them. But now I need to "get specific version" to take me back before all the breaking changes and somehow merge only my changesets into my workspace. But there seems to be no way to merge changesets into a workspace, only into another tree. I could select only the files that I touched and get the latest versions of those files, but some of the files contain changes from both my changesets and his changesets (and mine are after his).
So what I really want is a way to merge specific changesets into my workspace (without pciking up all the previous changes) to get back to the state I was in before I did "Get Latest". Is there any way to do that?
Looks like there's no good way to do this. Fortunately, I had another branch that represented the changes I wanted (I had only merged my changes I wanted into it). It didn't feel right to just copy the whole tree over my working tree, so I used WinMerge to identify the files that were different and copied just those files over (after a cursory look to confirm that it was a file that included my changes -- there were a few files generated by Visual Studio that were different just because they were in a different path).
So I guess the general solution would be to create a branch in TFS, merge everything you want into it, get a local copy, then copy the results into your workspace. That does leave a mess in TFS, though (how do you completely remove the dummy branch?) Fortunately the branch I had was one we really wanted to keep (we have a build branch separate from teh development branch).
I'm not really sure if this answers your question, but if you select "Get Specific Version..." then you can select a specific changeset.

TF203015 The Item $/path/file has an incompatible pending change. While trying to unshelve

I'm using Visual Studio 2010 Pro against Team Server 2010 and I had my project opened (apparently) as a solution from the repo, but I should've opened it as "web site". I found this out during compile, so I went to shelve my new changes and deleted the project from my local disk, then opened the project again from source (this time as web site) and now I can't unshelve my files.
Is there any way to work around this? Did I blow something up? Do I need to do maintenance at the server?
I found this question on SO #2332685 but I don't know what cache files he's talking about (I'm on XP :\ )
EDIT: Found this link after posting the question, sorry for the delay in researching, still didn't fix my problem
Of course I can't find an error code for TF203015 anywhere, so no resolution either (hence my inclusion of the number in the title, yeah?)
EDIT:
I should probably mention that these files were never checked in in the first place. Does that matter? Can you shelve an unchecked item? Is that what I did wrong?
EDIT:
WHAP - FOUND IT!!! Use "Undo" on the items that don't exist because they show up in pending changes as checkins.
I had deleted the files in trying to reload the workspace, even though I had shelved the changes. Then VS2010 thought those files were still pending to save. I didn't need that, so I had to figure out to "undo" the changes in Pending Changes.
Then I could unshelve.
It thought I had two ops (unshelve, commit-for-add) going simultaneously, and I thought I had only one op (unshelve).
This is a slight aside to the OP's question
You can get a TF203015 when you try and batch merge a multiple changesets from one branch to the other without due care.
Consider a situation where you have a MAIN trunk and a DEV branch. You branched DEV from MAIN and have diligently worked away at a feature in DEV; checking work back into DEV as you progressed. Now fast forward a week or two. You are now feature complete and want to merge back into MAIN.
This is where one of our devs hit this error.
He had been working on one solution for weeks, and checking changesets back into DEV periodically, so wanted to merge a non contiguous series of changesets back into MAIN.
So he picks the merge option, selects the first changeset; merges without issue, then immediately went to merge the next changeset; and bang TF203015, and its very unhelpful test in the output window; incompatible pending changes.
After a little fiddling around we now realize what is going on here; the first merge created a pending change in MAIN for the developers solution. The next merge attempt was also changes to the same solution, which would require TFS to "queue up" a second set of pending changes to the same files. It cant do this.
So in this scenario TF203015 means; "The destination branch already has pending changes on some files that are changed in this changeset. Please resolve and commit the destination branch changes before performing this merge operation"
The solution; after each merge operation our developer tests the workspace for MAIN and commits the pending change caused by the merge, then goes back to DEV and repeats.
Actually sensible and simple, but masked by a very obtuse error message.
You can use the Team Foundation Server Power Tools March 2011 (http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx) that includes the command tfpt unshelve.
Once the Power Tools are installed, open a Visual Studio command prompt, change to the directory that contains the project of interest, and execute the tfpt unshelve command. It will unshelve and display the merge dialog so you can resolve the conflicts.
I credit this blog post with helping me find this solution: http://fluentbytes.com/the-how-and-why-behind-tf203015-file-has-an-incompatible-change-while-unshelving-a-shelve-set
I had what appeared to be the same issue but I had created a branch after shelving my changes and I wanted to unshelve those changes to the new branch.
TFS cannot unshelve to a different path than the path upon which the shelf was created.
Solution: I unshelved back to the original branch then I used beyond compare to merge the changes from my original branch to the new branch and checked in.
It could also be that after you create a folder in say a "Test" and you want to merge from dev to test, that you do not have that newly created folder structure checked into TFS - You will /can also get this error message.
Thus this message error CAN occur without anything to do with SHELVESETS as well for others coming from google and finding this page.
This might be the same as jcolebrand's answer, but I'm afraid I found the phrasing there a bit abstruse. Sincere apologies if I'm just repeating.
In my scenario the incompatible pending change message was presented because I was trying to roll back multiple changesets, and the same file was affected by more than one of those changeset.
In my case I did not want to commit until all the changes had been rolled back. I believe if I had been able to commit after rolling back each changeset, the error would not have happened.
The method which worked for me was as follows:
I opted to roll back one changeset at a time. I found using the command line was actually a more informative way of doing this because it lists all the conflicts, whereas I think the VS UI rollback just lists the first.
While rolling back a changeset, if there was an incompatible pending change, I had to undo my workspace's pending changes for the affected files.
When all the changesets had been rolled back, I had to manually revert the files which had experienced incompatible pending change. Mostly this could be achieved simply by getting a specific version of the file (the "last-known-good" version before all the bad checkins started). But for some files where there had been both desired changes and undesired changes, I got the "last-known-good" and manually applied the good changes to it.
This link resolved my issue:
https://blogs.infosupport.com/the-how-and-why-behind-tf203015-lt-file-gt-has-an-incompatible-change-while-unshelving-a-shelve-set/
The reason was pending change in the same work space create an incompatible change. So undo the pending changes and try unshelve. This should resolve the issue.
If you have two branches MAIN(target) and DEV(source), now you want merge DEV into MAIN, then all files you want merge from your source, must not be older then the similar files in your target branch.
For example: you have an changed file test.cs in your DEV branch, changed at 14.03.2016. In your MAIN branch you have test.cs changed at 15.03.2016. So the target is newer then the source file and you have TF203015.
Solution: navigate in TFS Explorer to the conflict-file and merge it explicit. TFS will open the conflict manager and you can merge the conflicts by hand. Following you can merge the selected changeset.
Remarks: If you have more conflicts, you must navigate to each conflict-file and merge it explicit, so TFS opens the the conflict Manager and you can merge it by hand.

Resources