Baseless merge for multiple non-consecutive changesets - visual-studio-2010

I'm issuing the following command to TFS:
>tf merge /baseless c:\ws\source c:\ws\target /recursive /version:C100~C100
But I have a large list of changesets that need to be merged. Is there a shortcut for this, or some way to specify a list, for example:
>tf merge /baseless c:\ws\source c:\ws\target /recursive /version:C100,C108,C110,C800,C1001,etc...

If powershell is an option, below script should help (not tested!):
$cslist = 1,23,45,456,568 #list of all changesets
foreach ($cs in $cslist) { & 'C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe' merge /baseless c:\ws\source c:\ws\target /recursive /version:C$cs }

Grabbed this from another post, you may have seen it but as I haven't ran into this I'm just trying to lend a hand.
You have a couple options:
If you know the changesets you want to merge (or the changesets you want to avoid merging) you can choose a folder up the structure from the files you want to merge then do the merge by selecting the specific changesets you want. This is a little complicated if you have changesets 2000,2001,2004, 2010 and you want 2001 and 2010. You can only merge consecutive changesets in the list per merge so you would have to merge 2001 then 2010. This is still better than merging many files if you have more files then changeset groups.
If you want to merge everything under that folder up to a specific changeset or most recent changeset you can do that in one bulk merge.
In both of these you will still have to resolve issues where a different change was made to the same line in the same file in the source and target branches.
OP: Merge multiple files in TFS

The following extension claims to do this:
TFS Productivity Tools - Extended Merge 2012
ExtendedMerge extension provides workaround for several merge features
not implemented by TFS:
TFS merge leads to bulk check-in operation that puts files from all
previous changesets into one big merge changeset.
TFS allows only for
consecutive changesets being cherry-peeked by merge operation.
TFS
doesn’t allow choosing changesets for cherry-peek merge by selecting
work items.
TFS merge dialog doesn’t have “force” and “baseless”
options.
You'd might also want to upvote this feature in the Visual Studio User Voice.

Related

Merge TFS changeset between branches rather than selecting files

I am making changes in a feature branch and merging these across to the main development branch, by just merging the folders with modified files and letting TFS detect the files that need to be merged.
But is there not a way to say "just merge this changeset" so I know only the specific changes in a commit are being merged?
I am not having luck looking through the GUI or on Google for an answer one way or the other.
Is there something from the "Selected Changesets" merge option that isn't working for you? You're able to select specific change sets to merge, though there can be potential issues.
From the merge dialogue, select your source and target. Make sure to select "Selected Changesets"
Now select the changeset your want to merge:
Finish the merge:
As per usual TFS merge, the changes are merged into your workspace, and not commited until you actually check in.

Remove unchanged (content same) from pending files list in Visual Studio?

This is not a duplicate of an existing and answered question, like this one.
It is well known that VS pending files list shows all checked-out files, some of them might have no edits at all. And the recommended solution to remove those files without an edit is to run a TFS Power Tools command, as answered here.
However, this doesn't apply to the files that were changed (by a mistake, or on a purpose), but the change was manually reverted. In other words, if the content of two files is binary (or literally) the same, the "Undo Unchanged" command might still think the file has changed and does not remove it from the list.
Is there any way to force TFS PT to perform content-based comparison for pending files vs. latest server version?
Use local workspaces instead of server workspaces (on VS/TFS 2012 or later). With local workspaces, the only things that show up in the "Pending Changes" window are actual modified files.

Search by changed content in TFS VS 2010 or VS 2012

I have a file which has been modified several times in different versions of the product. I would like to search all the changesets in the history of the file and see if a particular string "CK_CLIENT_TIMEZONE" has been part of the changes in any changeset.
Currently I am doing this by viewing the history of the file and comparing two adjacent changesets manually. It will be excellent if there was a way to search only the changes in history and see which changeset had the change I'm interested in.

Using different source control providers with different instances of Visual Studio

I'm in a situation where I need to merge multiple branches of a codebase, one from TFS and one in held by git, into git. But it seems that two instances of VS share a single setting for source code provider so, for example if I want to check the history of a file in TFS prior to merging I have to manually switch providers under Tools -> Options, do my checking and switch it back.
Having to have two instances of VS running concurrently, is hard enough in terms of remembering what is what, having multiple branches is worse and having multiple source control bindings is the pits.
Is there a work-around?
You could use git-tf to create a temporary GIT working copy of your TFS data, do the merge all in GIT. And then commit the changes back to TFS using git-tf if you need to update TFS as well.

Delete merge history in a branch in TFS

Suppose I have a main branch and a dev branch.
Suppose I merge some stuff from dev into main.
I check in the merge
Now I decide "whoops, the dev branch wasn't really ready for me to merge into main yet."
I want to tell TFS: remove that change set from main and forget that the merge ever happened.
Rolling back the changeset is easy enough -- I can use the TFS powertools ROLLBACK command. on the Main branch (with the /changeset /recursive flags)
However, I will get a warning from the rollback that the merge history for the files has not been deleted.
Effect: Later, when dev is ready to be merged into main, the changes in the files that were rolled back previously are NOT merged into Main (this is because TFS "thinks" that those merges are already done.
My goal:
When I rollback, make TFS remove the merge history so that when I merge dev into main later on, everything merges.
How can I do that?
BTW: I'm using TFS 2008 SP1
Rollbacks in TFS 2008 aren't that great. It is essentially a re-check-in of a previous version. Since you lost that merge history, you may need to /force the merge from the command line when you do the merge next time. That should get it to ignore the fact that the previous merge history is out there.
I ran into a similar problem. One thing I think might help you is the tf.exe merge /discard option. What this allows you to do is perform a fake merge of files and remove the change from the merge history without actually performing the merge.
http://msdn.microsoft.com/en-us/library/bd6dxhfy(v=vs.80).aspx
Hopefully that helps!

Resources