Any time a new file is created, or an existing one is renamed, that file is automatically excluded in the pending changes. We have to promote all of those files in order for them to actually be checked in with the changeset. How can I change this so that all new/renamed files are always INCLUDED automatically?
Why is excluding them the default behavior? I can't imagine any scenario where you could or would desire to exclude them. If the new files are referenced elsewhere in the solution, it would obviously break and not compile for anyone who pulled the changeset with the missing files.
Related
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.)
When I check in changes in TFS Express 2013 using Visual Studio 2013 Professional, there is a list of "Excluded Changes" that has 1541 items in it.
I have never told TFS to exclude a change, and do not understand why anyone would even want to "exclude" a change (isn't source control all about SAVING changes???). I am a bit worried that I have changes that are not being saved...but am even unsure if this is even what it means. I have Googled for more information about "Excluded Changes" in TFS, but haven't found any explanation.
Can anyone explain to me: What are Excluded Changes? Why would I want to exclude a change? And why are there 1541 excluded changes that I never requested to be excluded? Should I be worried that changes are being excluded? Should I change these excluded changes to INCLUDED changes?
There are a number of things that can cause a "change" to be excluded:
Team Explorer will, by default, ignore files in obj/* and bin/* and a few other folders. As well as certain extensions like .csproj.user.
They're not loaded in your current solution, so Team Explorer assumes they're made as part of either a different solution and that you don't want to check them in together with the changes that do match the context you're in.
They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
They're manually excluded from the current checkin. You may do that when you want to first check in one file that fixed Bug 123, then check in another set of files that fixed Bug 124.
Files created outside of Visual Studio are never automatically added, so when you zip up a set of .cs files and that zip ends up in your workspace folder, Team Explorer will detect it, but won't add it automatically.
There is a final issue that may be going on here, if for some reason a project hasn't been added to source control, or the bindings in the solution file were not checked in correctly, then any file added to that project will be ignored as well, as Visual Studio assumes that project should not be under sourcecontrol.
Using "Add existing project" doesn't automatically put that project under the same source control bindings as the solution. which would cause team explorer to assume 6.
The path may previously have been "cloaked" or "unmapped", mapping a folder after the fact doesn't tell Team Explorer to add them.
You may have been working offline and were using a server workspace. When you tell Team Explorer to come back online, you need to ensure that all adds are correctly done. A Local workspace doesn't have this issue, as it can locally track the changes without having to talk to the server.
You may have chosen "Check in pending changes" from a subfolder in the Solution Explorer (or on an individual item or project) or in the Source Control Explorer. When you do that, Team Explorer scopes the Pending Changes window to only the items that match that context. All other changes are temporarily moved to the "Excluded Changes" section.
You should inspect the Excluded Changes list and either ignore them using your .tfignore file. You can do this from the UI as well by right-clicking such an excluded change and choosing the option to ignore by path/extension or pattern.
Basically, if you see stuff in the Excluded Files section, either right-click/include them or add them to your .tfignore file.
That way it's at least very clear that items in that list have not been evaluated yet and most probably need to be included.
You may also want to check your source control bindings by opening File/Source Control/Advanced/Change Source Control Bindings... to ensure that all projects show as bound to sourcecontrol and don't show any errors.
Some additional context
In Git as well as in other source control systems, changes are often not automatically pended. This is to prevent you from accidentally checking in stuff that you did not intend to. In Git you need to explicitly call git add to mark a change as one that you intend to commit. Until you do that the change is considered "untracked", which is essentially the "Excluded Changes" feature of TFVC.
Subversion (SVN) has a similar behavior where changed files are marked as unversioned and need to be added explicitly through calling svn add.
So this isn't very strange behavior for a source control system. It essentially puts you in control of your sources.
Wanted to give another case where files are excluded. If you add a project from template or a new item to your project that includes a default name like "MainWindow" then rename or delete that file before ever commiting changes. "MainWindow" will be in the excluded changes and the item with new name will be in Included changes. In this case you can safely delete them.
This is a weird problem I keep facing. I sometimes find that files that have been excluded in TFS are included and thus each time I check-in, these files that were previously excluded risks getting pushed into the server.
This kind of problem happens most often when I restart my machine. What am I doing wrong?
If you right click on a solution, project, or folder to check-in you are automatically calling "include" on that structure recursively. If you want to permanently exclude those files you can put a .tfignore file in there.
http://msdn.microsoft.com/en-us/library/ms245454.aspx
What's the proper way (sequence of steps) to rename a folder in TFS? I tried doing it locally then commit but it's not working. I think you prob have to do it from TFS (server-side) instead right? But then if you do that and get latest then I guess it'll just update your folder locally and hopefully you don't have any other conflicts?
Open Source Control Explorer, mark your module, press F2 & enter the new name.
Module will appear in your Pending Changes window with Change type "rename".
Suppose you had a module named test.txt which participated in 3 changesets. It then gets renamed into itsatest.txt When I get History for file itsatest.txt I get this:
In my hard drive the test.txt doesn't exist after the rename.
The same principle works with folders as well.
EDIT after comment
Problem is I did all this renaming locally on my file system...I don't
want to lose all these changes because I also changed namespaces in
code, etc
I see. One way to proceed is to copy the entire directory somewhere out of your workspace. Then delete it from your workspace and retake it from source control with 'Get specific version' and 'Overwrite all files even if the local version matches the specified version'. Proceed with the rename & checkin.
Perform a directory compare between your locally stored dir & the one you 've just renamed. All your changed files should appear. Check them out & copy-paste them manually into your workspace.This should take care of the situation.
I'm pretty sure I remember another TFS SO post, where the recommendation was 'never mix pending changes with pending renames' - can't seem to find it ATM...
I'm trying to find a way to merge shelve changes with the latest version I have locally without overwriting my local files with those of the shelve.
That is, I have a shelve from date 0, on date 1 some changes were done in the tree, on date 2 I do a Get Latest Version, then when applying the shelve, changes of date 1 get lost.
No merge conflict between changes in date 1 and those of my shelve.
Ideas? Thanks!
Finally, what I ended up doing was to
1) "get specific version" to the date when changeset was taken
2) "get latest version".
That way, TFS merges latest version with changed local files. (The other way around -what I was looking for- seems not possible).
Two options spring to mind:
(Advice: Before you start, back up your code, in case there is anything in there that isn't safely stored on the server or in a shelve set!)
If you unshelve first, you will end up with locks on the shelved (0) files.
Then GLV to get the (1) files. All the files you have locked will be merge conflicts, which you can then resolve, test, and check in as normal.
Get the shelved code and copy it to another folder on your hard drive. Then GLV the latest server code. Check out the files you have changed (or easier, the root folder), and then manually merge the two sets of sources. You can then "undo check out" to get rid of the unchanged files (say "no" to the "discard your changes" question and it'll keep locks only on changed files) and after testing that your code works, check in the resulting changed files.
You need another Workspace, that is a local folder were your working copy resides (Yes, you can have more than one).
With a fresh Workspace with no changes on it, you could recover your shelve there, do the check-in, and have your original workspace untouched. Optionally, you could delete the alternative Workspace, or keep it for these kind of maintenance tasks.
For creating a new Workspace, just open the Source Control Explorer and open the Workspace combo-box on the upper toolbar. Select Manage Workspaces and create a new one from there.