I am using perforce and I'm merging a parent stream down into a child stream. The child stream contains files that the parent stream does not (and should not yet). When I merge, it's telling me to delete those files in the child (presumably because they don't exist in the parent).
How can I tell it to stop doing this? In past merges I've just been reverting the deletes but now it's becoming a problem because I'm trying to copy back up from child into parent it's giving me a warning stating that there are outstanding changes in the target.
I am using perforce and I'm merging a parent stream down into a child stream. The child stream contains files that the parent stream does not (and should not yet). When I merge, it's telling me to delete those files in the child (presumably because they don't exist in the parent).
Files can't be merged from nonexistent sources. Enable the "show deleted files" option and I suspect you'll see that the files exist(ed) in the parent and have been deleted. (Maybe they were mistakenly added and subsequently deleted instead of being obliterated or excluded from the stream?) The merge operation wants to propagate that deletion into the child.
How can I tell it to stop doing this?
If you want to leave the target unchanged during a resolve instead of accepting the change(s) from the source, select the "leave target unchanged" option. (This corresponds to the "accept yours" option at the command line.) That will mark the source (in this case a deleted revision) as having been "ignored" and after you submit the ignore revision (i.e. an integrate revision with an ignored resolve action) it won't ever come up for merge again until a new revision is submitted to the source. If you just revert the file, nothing is recorded and so the source revision will remain outstanding for next time.
If these files just flatly should not exist in the parent stream, the stream spec(s) should be updated to reflect that -- exclude them from the parent stream, or isolate them in the child stream.
This is one of several fundamental flaws in the core Helix/Perforce source control data model, and has caused significant data loss on many occasions.
It appears that you must merge or copy down all "delete file" records before it is safe to add any files of the same name. This means all streams must have the delete (or rename) change merged/copied into them before any stream can safely add (or rename) a file of the old name.
P4V version 2021.3 claims to add some protection, however it's limited and will not cover the OP's situation.
Furthermore, if your Helix server is on Windows then this is case-insensitive (even though filename case is preserved)
Related
I have a simple structure in TFS. Something like this:
[Main]
|
---------------
| | |
[Br1] [Br2] [Br3]
The code is merged from Main to Br3 has been worked with in Br3 for a while.
Then one merge happened from Br3 to Main with a few conflicts (about 15 files) and once trying to check in on Main branch I get a huge number of files marked as changed to be checked in. I assume those are all the files in the Main branch. When randomly comparing some of the marked ones, there is no visible change between to two (even if displaying white spaces).
Anyone knows what happened here?
EDIT
How do I find out if the change would only be in the file access rights between my local and server file, and how could I ignore those kind of changes?
According to your comment. Since you are doing a baseless merge. Then its a normal phenomenon. When you did the baseless merge, every single file in the solution was marked as changed and listed in the pending changes during check in. There is no option which you can simply ignore those kind of changes.
Did you mean you want to find out 'the real changed files'?
You can try below workaround undo your pending changes. When you get the confirmation dialog choose "No to all". Only your pending changes should be left. from this question Files listed as pending changes when doing merges that didn't change?
Note: This works when you only have changes to files. It will not merge any New files that you have added.
The MSDN documentation lists four options, with limited explanation:
Overwrite "Overwrite existing writable files if they conflict with the downloaded files." Does this apply to all files, or just ones we've told TFS we've edited?
GetAll "Gets all files." What files does TFS not normally get?
Preview "Executes a get without modifying the disk." This one seems pretty clear.
Remap "Remaps existing items on the disk to the server items where the content and disk location are not changing." I have no idea what this means.
Overwrite: will blindly overwrite writable files that you have not pended for edit. If you have marked a file as 'writable' then you have violated the contract with TFS and it assumes that you have done this for a good reason (eg, modifying the file without taking a checkout, because you were working offline). This will generally produce a writable conflict on the file, but if you specify this flag, then the writable file will be overwritten.
This only applies to server workspaces (local workspaces are always writable). This has no effect on files that you have pended for edit. Get will always produce conflicts for files that are edited locally and updated on the server; if you want to update files that are checked out, you must undo the checkout (or resolve the conflict with TakeTheirs).
Get All: will download every file and update it, even if TFS believes that the local version is the same as the remote version and that downloading a new version would be a noop. TFS tracks every version that you have locally, as well as remotely, so this is only useful if you edit files locally without checking them out.
If you have kept them writable, then then - as mentioned above - this will be a writable conflict. If you have then marked them read-only then TFS assumes that you have not made any changes and will not bother updating them when you do a get (because it knows the file contents haven't changed). If you have manually changed the file contents, then marking this will update those files to the server version.
Preview: will just fire events and provide results that indicate what would be downloaded with the given parameters.
Remap: is a clever option that allows you to perform an in-place branch switching (which is very common with some version control systems that branch at the repository level - like Git - but somewhat complicated in TFVC.)
Consider that you have mapped $/Foo/main to C:\Foo, and done a get latest. If you update your working folder mappings so that $/Foo/branches/feature now points to C:\Foo, then issue a get with Remap, then the server will download only the changed files between main and branches/feature, so it's an inexpensive way to update your local workspace to a feature branch.
(If you're looking for an example, this functionality exists in the command-line interface and in Team Explorer Everywhere but not in Visual Studio.)
Is it possible to archive old data from MS Team System Source Control? We have up to 10,000 changesets in our TFS database, and are unlikely ever to want to go that far back, but the database files are getting ever larger. Is it possible to archive everything before a certain date (say) to reduce the size of the database? if not, taken to its logical conclusion a long lived actively developed project will eventually explode.
You can back up the whole TFS database and then use destroy command to permanently delete the source control tree. But you can do that only for whole source control paths, not specific versions.
In case there are many deleted files you can also use the same command to review the source control tree and permanently destroy these deleted files.
You will not be able to just delete old changesets because TFS stores incremental changes every time you check-in. This also implies that maybe you have large binary files stored in TFS - files larger than certain limit are not stored incrementally (thus saving space) but instead every version is stored complete.
Documentation on the command: http://msdn.microsoft.com/en-us/library/bb386005(v=vs.100).aspx
We've had this happen more than a few times were we consider it to be more than a fluke at this point. When we are merging back after we are complete with our branch there are way more changes then their should be. So most of the files showing as pending changes never changed (in most of the cases in neither the branch or the base). When i compare them (i use beyond compare) there are no differences. I haven't went through all the files that didn't change but in most cases it seems like they are marked as [merge] and the files that actually changed are marked as [merge,edit].
In one case we probably changed around a 100 files it pending changes showed more than 22,000 changes. We tried checking them in at one point thinking tfs would be smart enough to know what files changed and which didn't. But it checked in all files. Does anyone know whats going on and how to fix it?
We are running TFS 2012 w\ Update1
Everyone is using Visual Studio 2012 w\ Update 1.
For anyone having the same issue a work around is to undo your pending changes. When you get the confirmation dialog choose "No to all". Only your pending changes should be left.
Regarding the problem where you had changed 100 files and TFS wanted to merge several thousand. This is usually caused by renaming (or deleting and then un-deleting, or moving) a branch. This has bitten me a couple of times and I feel your pain.
The best advise I can give is, once you've created a branch, leave it alone. Don't move it, don't rename it. If the location or name of the branch are wrong, live with it until it's time to delete the branch and create a new one.
Because of the way TFS 201x work behind the scenes, changing the root folder of a branch effectively turns it in to a different object. When you try to merge the branch again, TFS will perform a baseless merge which effectively means that it appears that all files in the branch have changed (even though they haven't) This is new behaviour, older versions of TFS (2005 / 2008) don't suffer from this problem.
e.g. you have a Team Project that looks like this
$/TeamProject/Main
You then create a branch from "Main" called "Dev"
$/TeamProject/Dev
You can merge as much as you like and there shouldn't be any problems. Then you decide that the folder structure might get a bit messy when you have several dev branches so you create a folder called "Development" at the root of the team project and move the dev branch in to this folder
$/TeamProject/Development/Dev
OK now behind the scenes the move is a rename and a delete, the old dev branch still exists under $/TeamProject/Dev (you can see this by going to "tools", "options", "Source Control", "Team Foundation Server" and then check the setting that says "show deleted items in Source Control"
The folder called $/TeamProject/Development/Dev is actually a brand new thing! Therefore it doesn't have a merge relationship with "Main". Confusingly though the IDE will show a relationship, but really it doesn't exist. The first time you merge from $/TeamProject/Development/Devto $/TeamProject/Main TFS will perform a sneaky baseless merge to establish the branching relationship.
The same thing happens if you rename a branch (the old branch will be deleted and a new branch will be created under the covers)
This Blog goes in to some more detail
The comment above with the "No to all" option in the undo confirmation dialog works okay, but as commented by Mark Hosang, this will not work right if you have new files. Mladen Mihajlovic is right that you can make sure to not select those new files. However with a large code base, wading through this is very tedious.
So my method: before getting to the confirmation dialog, you are presented with a window to select which files to undo. This window has sortable columns. You can sort by the Change column and select only the files with merge status (these are the unchanged files; merge, edit are edited files and merge, branch are new files). Just click Undo Changes with just those selected, and then enjoy the beauty of an uncluttered merge changeset.
Try this:
select all pending files
on context menu click 'Undo...'
in the 'Undo Pending Changes' dialog sort files by 'Change' column
deselect all files except 'merge' using shift+click
click button 'Undo Changes'
From my experience this happens when TFS has no relationship between file A in branch A and file B in branch B.
When merging branches TFS always creates a relationship between the files when no relationship is present already. Hence it wants to check in as "merge" to remember these relationships.
I tend to undo these "merge" changes when i don't need the relationships (e.g. for reparenting).
Is there a way to override a branch in TFS 2008 with the content of its parent?
I've tried a merge (but no way to specify a complete refresh in the UI)
but i am unsure because i would like to completely refresh the entire branch.
any thoughts on that?
If you want to synchronise the branches so that the child branch is identical to the parent, I'd just take a new branch from the parent. This is the easiest way to make sure that they are completely the same. You can then delete \ archive the old child branch.
If you merge from the Parent to Child TFS will check all the files in the branch and the following rules apply
If a file has been modified in the parent, but not in the child (since the child branch was created) then the file from the parent will overwrite the file in the child.
If a file in the child has been modified, but not in the parent (Since the child branch was created) then the file in the child will not be overwritten
If a file has been modified in both the child and the parent (since the child branch was created) then TFS will bring up the conflict resolution tab and you will be given the option to keep either version of the file, or to merge the files creating a 3rd version that contains a combination of the changes.
In the conflict resolution tab you can select all files and choose to keep the version from the parent. However any files modified only in the child will not be overwritten (see point 2)
You could also use the command line option
tf merge $/Project/Parent $/Project/Child /force /recursive
This will tell TFS to attempt to merge files that it already thinks have been merged to the file. I still don't think it will merge files that haven't changed since the child was created though.