When I delete and re-add a file in Visual Studio, which is under TFS-SourceControl, if I check in, the TFS only detects the Delete, but not the add.
Since we trigger a "Compile"-Check after each checkin, this always triggers an error, since the newly added File is not found, so we have to check-in twice.
Is there a possibility to tell the TFS to mark the deleted/added file not as deleted, but just as changed?
What exactly are you trying to do? If you delete the file, TFS will set the state of the file in source control to "delete pending". It isn't possible to then change the state of the file again to something else without either first checking in the pending change or undoing it. Delete and Add are incompatible pending changes on the same object.
Surely if you are deleting then re-adding a file you are in effect making an edit change, which would be properly tracked in the history. Why not check the file out for edit and assuming the new content is radically different from the original, overwrite the checked out file with the new content and then check it back in.
select the files that don't have the blue lock icon next to them and open the context menu and add them to source control (include in project) then Pending changes will see them
For me the issue was with re-added Table in Entity-Framework.
In EF DB-First when changing column definition in DB, EF does not detect any change or when removing a column. (ex: when making a column nullable)
This is only fixed by removing and re-adding the table in the edmx.
TFS only detects the remove, not the add of the table's .cs file. Then TFS doesnt let you revert the delete because "file already exists"
This can be fixed by opening the local CS file in a text editor to save the current generated code (1. save the local cs class), then delete the file (to match the tfs state) so that you can revert the delete in the pending changes (2. delete the physical cs file) (3. revert delete in the pending changes window), then manually replace the reverted cs file code with the one saved in the text editor (4. manually update the cs class with the code saved in '1'). Review and Commit your changes.
Related
When files in a tfs workspace are moved outside of tfs (eg. through windows explorer), tfs picks these moves up as a delete and an add.
To get around this, I have a program running that monitors for changes and when a move happens I do a Workspace.PendRename with updateDisk set to false.
This works fine except that tfs adds the delete as a candidate change.
Is there anyway to remove this candidate change? It causes issues if people try and promote these changes.
By using Workspace.GetPendingChangesWithCandidates I can get the candidate change, but there doesn't seem to be anything I can do with it to remove it from the list.
Before doing the PendRename, I tried moving the file back to it's original location (File.Move) and then doing the PendRename with updateDisk set to true. This actually works well for single files, but gets complicated when folders and such are involved.
I'm hoping there's a simple way to either remove the candidate change from the list, or to even disable the candidate changes functionality altogether for certain files/folders. I tried adding the folder to the .tfignore file but that doesn't work.
Promote Candidate Changes shows deletes even though files were renamed
In TFS there are two kinds of moving files. I have crated a sample for both :
Local Workspace (window exploer) directly move/drag file
In the disk my workspace, I'm going to move 2.PNG to Main-branch
folder
Then we could check what TFS detects in VS. One with add(in new
place), one with delete(in old place) in Promote Candidate Changes.
You need to check in both the add and delete ( promote first). Finally
you will get what you want both server and local.
Move a file in solution explorer directly
In the solution explorer , I'm going to move 1.PNG to Main
folder by right click and select move.
You will get a pending change with rename status directly and
not any Promote Candidate Changes.
Then we could check our local workspace, you will see 1.PNG is
automatically deleted in the workspace folder even though you haven't check in changes. Finally checking pending
changes, everything is fine and clean.
Back to your question: Promote Candidate Changes shows deletes even though files were renamed.
The TFS API should be using the way 2 above. Look at the parameters :
updateDisk
If true, the local disk is updated according to the pending changes;
if false, the disk is not modified and changes are not
acknowledged.
So if you set the updateDisk to false , the 1.PNG should still exist in the disk and TFS detect it and adding to promote Candidate Changes shows deleted. Which meets your screenshot. The solution should be change the value from false to true.
I've been experiencing some situations where I feel as though what is present in a changeset of mine isn't always representative of what I did.
Example: I incremented a version number in AssemblyInfo.cs through the project properties GUI and in a couple other locations. I then checked in my changes and moved on deploying things.
Come to find out, the AssemblyInfo.cs file had been emptied. I checked on my disk and the file contained binary of all zeros.
This is the most recent event in a series of headscratchingly frustrating changeset issues.
Is it possible for someone to tamper with a changeset without leaving any audit trail, or is it possible that the GUI in Visual Studio is corrupting certain things on me?
When you check in your changes, they are stored on the server as a changeset. Changesets contain the history of each item in version control.
You can view a changeset to get information about:
•which files were changed
•what the exact changes were
•who changed the files
•what the check-in comment contains
•which work items are associated with the changeset
•which policy warnings appeared
TFS won't tamper changesets if you have a successful checkin. You can try on another client machine to see whether your issue persists.
No, it is not possible to make changes to TFS version controlled files without leaving any audit trail by anyone or GUI.
You are able to check the file's history via right clicking the file in the Source Control Explorer and click "View History". From the listed changesets, you are able to check who submitted the changeset on which date. If you don't want any one specific changeset, you can just rollback it.
I am trying to write a simple app in C# for source controling database files using SharpSVN library and have some problem implementing atomic commits.
This is the workflow i have in mind:
User changes some files in database locally
Compares to source control and checks some of the changes for comiting
Loop through all selected changes (could be: add file, modify, delete) and apply them to the SVN working copy
If everything is succefully applied to working copy, call commit, else revert all
If commit is unsucesfull revert all
I am adding files to local working copy by calling File.Copy(temporaryPath, workCopyPath) and then SvnClient.Add(workCopyPath)
I am adding modifications to local working copy by calling File.Copy(temporaryPath, workCopyPath)
I am removing files from local working copy by calling SvnClient.Delete(workCopyPath)
In case of error while applying changes to working copy i tried to revert to the state before changes by calling SvnClient.Revert(workCopyRoot)
but that does not revert all changes (for example, added files are still in workin copy after revert).
If everything is ok after applying changes, i call SvnClient.Commit(workCopyRoot) to apply changes to remote repo.
Is this a proper way to apply changes to working copy or should i use something else?
Should i monitor changes to working copy and revert them manually (without SvnClient) or i am just missing some parameter for the SvnClient.Revert() method?
Thanks in advance, any help is more than welcome
I would like to delete the the revision of just one file. I've been trying a lot of different ways and also reading some advice here and on google.
I simply want to do like if that single file had never been modified with the last revision.
Is it possible?
If you use TortoiseSVN: just right click the file -> show log. Go to revision you want to revert -> right click on revision an revert changes form this revision. After that you have to perform a commit to bring your changes to the repository.
My problem is how to know what files or folder are changed before do commit. I can add all the new files in my working copy before do commit, and the repository changes, but if for example i delete one file of the working copy i dont know the way to add this change before do commit. When you use the tortoise for example before do commit the program shows all the changes of the working copy and you can choose what changes commit and what changes dont. There is some way to do this usin sharp svn?? thanks for your answer!!!
svn status
will tell you the state of the working copy compared to where it was before your last update/commit, if you want to delete something in svn use svn delete