16

In TFS 2010, how can one mark a changeset so that it cannot be merged from one branch to another? For example, so it doesn't show in the "merge wizard" in Visual Studio when using the "Selected changesets" option. Basically, I want it to look like the changeset in question has already been merged into another branch.

Our build process auto-increments the version numbers in all our AssemblyInfo.cs files. A changeset in a release branch that contains only version increments should not be merged into trunk (or another release branch, of course).

I believe this is analogous to the "Only record the merge (block revisions from getting merged)" checkbox in TortoiseSVN.

2 Answers 2

21

I think I found the answer to my question. The tf.exe command has a switch "/discard" which is documented as "Does not perform the merge operation, but updates the merge history to track that the merge occurred." This is exactly what I was looking for. I'll try it and post an update if this not what I'm expecting.

http://msdn.microsoft.com/en-us/library/bd6dxhfy(v=vs.80).aspx

3
  • 2
    Here's an example of the syntax for it (for my own benefit when I next google this...) tf merge $/sourceBranch $/targetBranch /discard /recursive /version:Cx~Cy Cx~Cy are changeset numbers that can be a range, e.g. C100~C102 or just a single changeset number for discarding a single changeset, e.g. C100~C100
    – Ted
    Commented Aug 23, 2017 at 9:01
  • 1
    For a single changeset, try just specifying /version:C100. AzureDevOps will tell you "There are no changes to merge" if you specify a range for a single changeset
    – StingyJack
    Commented Jul 2, 2019 at 13:35
  • 1
    @StingyJack (How odd, I find myself back at this comment (via Google) after two years, only an hour after someone comments on it!) My current requirement is to /discard a non-continuous set of Changesets e.g. C100, C200, and C300. Do you know if I could specify /version:C100~C300 to ignore all of them, without causing any side effects, or should I /discard /version:C100, then /discard /version:C200 etc (30 times in my current situation). Thanks in advance!
    – Ted
    Commented Jul 2, 2019 at 15:11
0

There's really not an analog in TFS for what you're trying to accomplish. Within TFS each subsequent changeset for a file is a delta off the previous changeset (and so on down to the base revision). Therefore, you can't really "skip" a changeset.

I'm not sure exactly what you mean by "version increments" in this situation. Are you talking about file/assembly version, or something else?

1
  • Thanks for your reply. I don't mean skipping a changeset all-together - only so that one changeset cannot be merged (at least in the GUI) from one branch to another. For the version increments, yes it is file/assembly versions. I'll update the question to be more clear on those.
    – joelsand
    Commented Oct 26, 2010 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.