We are using a SymStore on a fileshare and I recently noticed, that there are over 100k transaction files in the 000admin folder. About 95 % of these files have an .deleted extension, because they have been already deleted.
So is it safe to delete those files to save some space and make life easier for NTFS?
TLDR: no, in general it is not safe to delete these files.
Long answer: SymStore can do different operations, main of which are "add" and "delete". On every operation it changes files in 000Admin folder, adding there information about what was added or what was deleted. Later this information can be used by other SymStore commands, like "symstore query" command, for example. If you delete some of the transaction files from 000Admin folder - it means history of commands will not be accurate anymore and "symstore query" can't work properly.
Of course, if you are 100% sure you don't use such commands and you just need to store pdb files - you can delete files in 000Admin. However, you should understand some functionality of SymStore will not be available to you anymore.
Related
As part of my TFS 2018 build, I want to move files using the Copy Files and Delete Files tasks together. I am using the same file match patterns in both of these tasks, but I seem to be getting different behavior.
Scenario: My TFS build copies build artifacts to a network folder \\some\path\Beta. In my build, this path is saved as a variable, $(NetworkPath). The root folder of these artifacts is a version number that is, of course, changing on each build. I want to clean this folder up by adding $(NetworkPath)\PreviousVersions that holds all previous versions, so that the only version shown in "Beta" is the most recent build.
My Attempt: I've added a Copy Files task (first) and a Delete Files task (second) to my build. My idea is to copy everything in $(NetworkPath) into $(NetworkPath)\PreviousVersions (excluding the contents of $(NetworkPath)\PreviousVersions), before I do the second copy to put the new version into $(NetworkPath).
In the task definitions, the Source Folder of both tasks is $(NetworkPath), and the file matching patterns I've defined in the Contents field for both tasks are:
**\**
!PreviousVersions\**
The Target Folder in the Copy Files task is, naturally, $(NetworkFolder)\PreviousVersion.
Results: With these search paths, the Copy Files task works properly -- it copies everything that is in $(NetworkPath) but is not in $(NetworkPath)\PreviousVersions and puts it in $(NetworkPath)\PreviousVersions. The subsequent Delete Files task, though, deletes everything from $(NetworkPath), including the entire $(NetworkPath)\PreviousVersions folder. I expected it to only delete the files and folders in $(NetworkPath) but not in $(NetworkPath)\PreviousVersions.
What am I missing here?
Here are the workaround file matching patterns I found to achieve the behavior I wanted:
For the Copy Files task: *.*.*.*\**
For the Delete Files task: *.*.*.*
Clearly, this exploits the fact that the files I wanted to move have a root folder which has a version number as its name (i.e. 2.5.0.11), so this solution is not applicable to many people.
That said, here are some things that helped me narrow down my issue and solution:
globtester is a handy little minimatch pattern tester.
When dealing with these two tasks, setting debug = true in the queuing panel of the build will give you more useful logs on what the match patterns are actually doing.
For most scenarios, Daniel Mann's comment above is applicable, and I will be discussing such a change in the future.
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.)
I placed a file to be accessible by clients for download in my Web API project's App_Data folder. It worked fine on the first couple of tests, but then all of a sudden the server app complained about not having permissions to accept the file.
It turned out that the file had been automatically locked following a checkin of code. How can I prevent this file from being locked again? I simply "checked it out" of TFS, but I don't want to have to continue doing that.
At "checkin time" I can select the file in question and opt to "Exclude" it from the checkin, but it again reverts to being locked after the checkin process has completed.
Is there a way to mark a file or folder as a "no lock zone"?
There's a confusing terminology overload here: the file is marked as read-only on the filesystem. TFS uses the term locked to indicate that the file is checked-out by a given user and cannot be checked-out or checked-in by other users. The file is not locked, but it is read-only.
Team Foundation Server - when you're using a server workspace - marks the files as read-only when they are checked-in to the server and sets then to writable when the files are checked-out.
It sounds like you do not want this file in source control anyway. You should delete these files from source control (but not from your local machine). In the future, you should carefully review your pending changes so you do not add files that you are not interested in having in source control.
Is there any mechanism available (preferably through the TFS API) to delete the drop output of a deleted build?
We have a number of deleted builds were the drop output still remains, as a result of the retention policy of the build definition in the past not being set to delete "All".
Querying the relevant builds and "redeleting" with IBuildDetail.Delete() or IBuildServer.DeleteBuilds(builds) has no effect (which one may expect), nor does IBuildServer.DestroyBuilds(builds).
Is the only option to get the drop location from the IBuildDetail and use the standard System.IO file/directory classes to perform the directory delete?
That would be my guess. At this point those folders are just regular old windows folders, since the build(s) they were linked to no longer exist. So I would expect to use a regular old delete folder command if I wanted to delete them.
The "Community TFS Build Manager" extension provides this functionality. Just delete your build and it will remove the contents from the drop folder as well.
http://visualstudiogallery.msdn.microsoft.com/cfdb84b4-285e-4eeb-9fa9-dad9bfe2cd10
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...