Is it possible to check-in only files that contain modification with Team Foundation Server? I mean is there an option to activate this somewhere?
I need it when an outsourcing company send us almost an hundred source code files and I want to check in only the modified ones.
When you perform a check in, Team Foundation Server will not accept items in your changeset that are unmodified, however the rest of the changeset will succeed. If all files are unmodified, you'll get an error and your changeset will not be committed. So if you're just worried about cluttering your history with changes that didn't actually change the content, then TFS will take care of this for you.
However, it can be obnoxious to have a lot of pending changes that don't actually have edits. If what you want to do is only see what's actually modified for code review or just general sanity purposes, the TFS Power Tools contain the tfpt command, which has an "Undo Unchanged" feature that will undo the check outs on unmodified files.
The undo unchanged command has the following usage:
tfpt uu - Undo unchanged
Undoes redundant pending changes. If the state of an item with a pending
change is the same as on the server, then the change is undone.
Usage: tfpt uu [/changeset:changesetnum] [/recursive] [/noget] [filespec...]
/changeset Compare the workspace to item states at the changeset
version specified instead of the latest version
filespec... Only check the listed filespecs for redundant changes
/recursive Check the specified filespecs with full recursion
/noget Do not run get before checking
The /changeset option may not be used with filespecs or /recursive.
For example, the following command will do a recursive get on TeamProject, provide a list of files with redundant changes and then prompt the user if they want to undo them:
tfpt uu C:\TFS\TeamProject /recursive
TFS ignores unmodified files during the checkin.
However, if you want to see what files are unmodifed before you check in, you can do this (carefully):
Select all files in the Pending Changes window
Right click and Undo Pending Changes
If any files have been modified, TFS will ask if you wish to discard your changes. Click No All.
Locks on all unchanged files will be released, leaving only the changed files in your pending checkin list.
But be very very careful which button you press!
By default TFS will only check in files that are modified, in fact I don't think it is possible to check in *un*modified files. If you use the command line unmodified and not checked in files will be recorded.
By default checksums are compared to avoid uploading files.
I'm not sure that there's a way to do this within Visual Studio. You might want to try a tool like Beyond Compare to compare the folders to find out which files have changed, then just check out those files. Beyond Compare also has excellent integration with Visual Studio.
Beyond Compare
In Solution Explorer, you need to right click on "file" or "folder", and then click "Add files to source control". This is using VS 2015.
Related
I am new to using TFS source control.
I have a large project which I have been porting from SVN. I am checked in and up to date with all projects. However, I opened up Visual Studio today and all project items are in the pending changes included window even though there are no changes.
I haven't touched or edited any of the files for my TFS files since last time.
To verify, I used Araxis Merge to do a folder comparison and can see that no actual changes have taken place.
Why are these unchanged files appearing in my check-in window?
Here is an example of a diff in visual studio from the previous version:
I can't see anything!
Hopefully this shows my local workspace
When you create or edit a workspace, you can specify whether its location is Local or Server. Local Workspaces are TFS's attempt at DVCS and actually gives you a much more SVN-Like experience.
Edit the workspace and choose advanced, you could see the Location of workspace type.
Maybe formatting, line endings, encoding. Do a diff using Beyond Compare or something to see what changed.
If nothing changed, check if you are using the same workspace. You may select another workspace than you used.
In Source Control Explorer, check if you choosed the workspace the workspace you were work in.
If all above not work, you could also try this workaround, select all the files in "Pending changes" window and activate the context menu. Then click "Undo..." > "Undo Changes" > "No to All".
The files without changes will be rolled back. More details please take a look at this question: how to undo pending changes of files that are unchanged?
I am doing a merge between two branches and TFS/Visual Studio 2013 is identifying 1800 files required to be merged. However, doing a diff between the two branches shows that there are only ~100 that are actually different.
The pending changes window mostly corroborates this, as all files are listed with a [merge] status except those which have actually changed; those have a [merge, edit] status.
Is there a way to filter the pending changes list to only show files which are really changed so I can do inspect the differences visually? It is very error prone to have to scroll through and manually do this, skipping items that show only [merge].
My current alternative would be to do a diff on the branches, and specifically look in the pending changes window at files which are identified as different, but that is rather cumbersome for something that should be simple.
Edit: Here is a screenshot of the pending changes window. I only care about the items which are [merge,edit] as it means there is a change and I want to see the diff. Conflicts will be shown in the Resolve Conflicts window. I don't care about [merge] items, as they are identical. There are 1000s of files with no changes, but I want to single out the ones that have changed and inspect the diff.
Try the following trick:
In Team Explorer, Ctrl+A all the included changes, right click and select Undo...
You'll get the Undo Pending Changes dialog with all the items selected. First of all, uncheck everything. Then observe that you have a column named Change and you can sort by it to have all the [Merge] changes stacked together, and you can check them all together and undo only them with a single click.
There is a tool which achieves that, "qbus vMerge" - which is a Visual Studio 2012/2013 plugin available in the Visual Studio Gallery. But it's only free for team projects with up to 5 registered users. In the pre-check-in dialog, you can filter the changes by Edits, Deletes and Adds.
Link:
http://visualstudiogallery.msdn.microsoft.com/cb2f3f5b-7cea-4f2b-9d47-0e51b2619bd0
Confession: i am one of the contributors.
You can do the merge and before checking in the files, just compare your branch folder with the latest version. So if you are merging from anywhere into branch-Servicing for example, Compare $/branch-Servicing with your local workspace for that branch:
You will get a list of all files that are binary different. With a simple double click, you can view the diff.
If you want to view all changes in a merge, excluding merge-only with no changes, the easiest way is to run tf diff from the VS command line. This will use the diff tool on all changed files. I believe this shows adds as well as edits. I do wish you could sort the pending changes window by type of change action like in previous versions.
I have been struggling with the same issue. ChangeType used to be a column that was available in the list view of vs 2012 pending changes. I was hoping it would be added to 2015, but no such luck.
Here is a command-line way of doing this against the pending changes:
tf status {pathToWorkspace} /format:brief /recursive | find ", " > c:\merge.txt
ex:
tf status c:\tfs\main /format:brief /recursive | find ", " > c:\merge.txt
It's not pretty, but at least it gets the filtered list easily.
Summary of: http://thesoftwarecondition.com/blog/2011/05/01/tfs-pending-changes-ignoring-files-which-are-identical-to-the-originals/
Method 1: TFS Power Tools
Install TFS Power Tools and execute tfpt uu /noget /r * in the root of the branch. As a result, TFS will go through and undo checkouts for any unchanged files whilst leaving your modified files untouched.
Method 2: Undo Checkout
Another option is to "Undo Checkout" all the changes, and clicking "No to All" when asked to confirm for undo checkout. This way Visual Studio will "undo checkout" all the files that are not changed, and all the changed files will remain checked out.
Drawback: this method undoes renames.
My question would be why do you care?
If you do the merge TFS will figure out at run time that the files do not need modification and you will not see them as changed in the annotate tool. However if you pick-and-choose the files to merge you will leave a bunch of "pending merges" hanging around that you will have to deal with later anyway...
If there are conflicts TFS will highlight them to you for dealing with.
If you do need to compare before you merge you can use the built in diff tool in Visual Studio that will let you diff a branch (or just folders) local->local, local->Server or Server->server.
My team and I started a project at Azure and we have a git as the VCS/SCM.
One of my partners had made a few changes, and he had commited them. When I try to get those changes at my local repository, and I press sync at the Visual Studio, the following message appears
Cannot merge because there are uncommitted changes. Commit or undo
your changes before merging again. See the Output window for details.
The output window shows the message below
Cannot complete the operation because of existing changes to the
following file:Project\Project.csproj
I have searched everywhere at google, but I did not find anything similar.
Can anyone help me with this?
We are stack.
Thanks a lot
It probably means VisualStudio automatically added some references to the file ProjectProject.csproj, where it keeps general project settings. In VisualStudio 2013 you may do:
Go to the TeamExplorer
Select "Changes"
Search through Included and Excluded Changes, .csproj file is probably there
Right click on it and select compare with unchanged to see the differences
Now choose to commit it or undo the changes (if, for example, the changes are not necessary) to be able to sync with the current repository.
I had this same dilemma and it turned out that somehow the file that was preventing me from switching branches and was in my solution, was not being tracked like the other files were. I just added it to source control via the explorer window, committed and pushed it, then I was able to switch branches just fine. Hope this helps.
When I make edits to file, TortoiseSVN will show an indication on the folder that file belongs to that there are changes pending to child items. AnkhSVN only shows (red tick) changes to a project when files are added/removed (because the actual content of the project file in this case has changed)
Can you make ankh give any indication at the project level that child items have been edited?
Unfortunately, no. Ankh only shows an indication on modified files, whereas TortoiseSVN can traverse folders recursively and mark those with changed files within them.
If you desperately need this feature, you can try out VisualSVN plugin. It tries to mimic TortoiseSVN behaviour as close as possible. In fact, it uses TSVN dialogs for operations such as Commit or Update, for instance. When you modify a file within a project, it highlights the file, the project this file belongs to, as well as the solution node in the Solution Explorer.
Unfortunately, it's not free (US $49 per seat), but IMO it is worth its price.
The recommended way to see what changed globally in AnkhSVN is the 'Pending Changes' toolwindow. This shows you all interesting files in a single view and allows you to operate on them easily.
You can open the toolwindow via View->Pending Changes.
Try this:
Right Click the File -> Subversion -> Lock
This places a lock on the file so that others cannot edit it.
When you commit, it should unlock the file.
If it does not, Follow the same steps and select Unlock.
Edit: I use AnkhSVN for my svn but it's just me that uses it. If a corporate environment I mainly use TFS which does the same thing (lock/unlock) but it does not allow others to check out.
Somehow, due to folder renamings and various other source code changes, I'm having an irritating problem. I'm showing a pending change for a file that cannot be undone in TFS.
This is a little hard to completely explain. Here is what the directory/file structure looks like in TFS:
RootFolder
Folder
FileA
FileB
OldFolderThatWasRenamedToFolder (shows add icon)
FileA (shows "edit" pending change)
"OldFolderThatWasRenamedToFolder" had been renamed to "Folder" and is committed to TFS like that. The "FileA" under that non-existing folder references the same file as "Folder/FileA" but registers as a different file; for example, if I change "Folder/FileA," pending changes are shown for both "files." Whenever I undo pending changes for the phantom file, TFS reports the error:
No pending changes were found for .../Folder/FileA.
I cannot get rid of this annoying false pending change. I've done an update in the folder forcing an overwrite and even deleted the folder prior to the update. How can I eliminate this phantom pending change?
Update:
I found a potential clue. When I compare the "pending" file with the latest, no changes are detected, but when comparing with the "Workspace version," the file is compared with an older version of the file. I've recently tried deleting my workspace and creating a new one, but the same problem persists. What exactly is going on? Where are these pending changes even stored? Is there some file I can manually edit?
In visual studio 2010, you can right-click on the phantom pending check-in on the "Pending Changes" panel and click "Undo..." on the popup menu, then click button "Undo Changes" on the dialog box "Undo Pending Changes", the phantom pending check-in will be removed from the list.
You should be able to undo the pending change with a 3rd party tool called TFS Sidekicks.
It is a free set of utilities by Attrice. I use it especially when I (or a client) come across such problems, as well as permissions issues, and the like.
Moreover, the tool will allow an administrator to do the same for other users. That means that it will solve situations where code is marked as checked out by a user that may no longer exist in the system.
Download it at http://www.attrice.info/cm/tfs/index.htm
Hope this helps.
I figured out a way to fix this using the tf.exe command line. By entering this:
tf undo /workspace:MyWorkspace $/.../RootFolder/OldFolderThatWasRenamedToFolder/FileA
...I was able to undo the pending change. If anyone knows how to do this same thing without resorting to the command line, I'll accept their answer instead.
I know this is an old post, but I expierenced the same thing.
What I found: John Kurlak's command line worked for me. I wanted to try something so I ran the TF MERGE again. This time I closed all Visual Studios open and then reopened it. The files showed up in Pending Changes and was able to Undo from there.
I know this is an old question, but I just faced that issue and I was not able to figure this out with sidekicks or tf command line tool. In my case the solution was close the solution and delete the .suo file.
John Kurlak's comment helped me a lot, but let me describe what issue happened in my case and how I solved it.
I've tried what he has suggested:
I opened the developer console, did a cd to the directory of my branch, and ran:
tf undo * /recursive
Then selected "All" when the tool asked "Undo your changes...? (Yes/No/All)".
In my case that was not enough, because NUGET left some files which were not added to TFS. That caused the tf tool to abort with the error:
TF400024: The change on
C:(SomePath)\themes\base\images\ui-icons_cd0a0a_256x240.png cannot be
undone because a file already exists at
C:(SomePath)\themes\base\images\ui-icons_cd0a0a_256x240.png. The file
must be deleted from disk for the undo to succeed.
In this case, I had to delete those files mentioned manually, and then retry until it succeeded. That had to be done a few times.
Note:
Those files can be found easier in the file explorer if you have the TFS power tools installed, because the files belonging to TFS have a green triangle in their icons, the other filies (the ones you need to delete) not.
I had a similar issue with a project that is stuck in AX version control/pending objects with “Add” action. I could not get rid of it by clicking on “Undo checkout” because it no longer exists in AX projects, local repository, nor in VSTS. To get rid of it, I created the project in AX/projects/shared then was able to get rid of it by going to AX version control/pending objects and clicked on “Undo checkout”. I believe this occurs when you create an object in AX, add it to version control, then rename the object afterwards. Hope this helps.
I am still new to VS2010, but this is how I fixed this issue for me:
Go to Source Control in the Team Explorer panel. In the Source Control Explorer, right-click the directory, project, or source code file for which there are pending changes to be ignored. Select Undo Pending Changes. A modal dialog appears confirming the Pending Changes that will be undone. Select Undo Changes, and voila! No more phantom pending changes.