TFS 2012 checking if a branch has been merged
Asked Answered
L

3

6

I have recently moved from Mecurial to TFS 2012 to take care of source control. So far I really like it, but I am just stuck on one aspect of it, so I was hoping someone on here can help me.

Let's say I have a branch called "Main", and then I branch from this, calling it "Feature 1". I can work on the modifications in "Feature 1" and then at this point Mecurial would draw a fork in the road.

If I then merge my "Feature 1" changes into "Main", Mecurial would then visually join the fork back up again. I could then make some more modifications to "Feature 1" which would cause another split, and once again, Mecurial would give me visual representation of this.

I have tried the same in TFS, and although the actual branching and merging is very easy, what is hard to work out is if the latest changes within "Feature 1" have been merged into "Main", or if there are outstanding changes to be merged.

The "Track Changeset" feature comes close and will let me know that "Feature 1" has been merged with "Main" at some point, but it doesn't display if "Feature 1" has been modified since the last merge.

Basically what I'm asking in a nutshell is, "How can I tell if a branch has any changes since the last time it was merged with the parent?"

Perhaps I am just stuck in the ways of which Mecurial used to do things, but I'd really appreciate some help or guidance with the above problem.

Lxx answered 6/8, 2013 at 12:35 Comment(0)
L
4

Update:

There is no visual indicator for this in TFS, but "TF.exe Merges" command is the closest that you can get to that particular feature. TF.exe Merges + Track Changeset + View History will help you achieve this.

Format: tf merges [source] destination [/recursive] [/extended] [/format:(brief|deltailed)] [/login:username, [password]] [/showall]]] [/collection:TeamProjectCollectionUrl]

Open your visual studio command prompt and type tf.exe merge /? for more details.

Example:

tf.exe Merges /recursive C:\projects\Main C:\projects\Dev

Changeset   Merged in Changeset   Author     Date
> --------------------------------------------------------   
135         162                   user1     4/13/2013 

146         162                   User2     5/16/2013 

147        167                   User1     6/18/2013

When you run this, you will get the last changeset which was merged from a MAIN branch to the DEV branch. Note the last changeset number which was merged (147 in this case). You can go back to the Main branch -> view history and check if there are any new changesets added after 147 in Main. In that case, you will have to do a Merge, else no.

Makes sense?

Also one more thing, I would suggest is to force the developers who do the merge to use a specific format for the check-in comments during merge, for example

"******MERGE****** Source branch name, the last changeset etc". 

This would also help, but dont count on it since people may not do it or will make mistakes.

MSDN LINK

Legitimacy answered 7/8, 2013 at 15:4 Comment(1)
Thanks for your reply - I still can't see how I can be sure that no changes have been made since a merge though. Could you explain how I can check with a little more detail using my example above? ThanksLxx
M
0

As far as I'm aware there isn't any easy visual indicator to show this (although it would be awesome if there was). I believe "Track Changeset" or just a brute compare are your only options.

Max answered 6/8, 2013 at 22:21 Comment(1)
That's a real shame. As far as I can see, it's the only real drawback to TFS.Lxx
W
0

I got the error Operation failed: TF401192: The source branch has been modified since the last merge attempt. (409) in a documentation repo PR where we have no CI. My branch was behind main and the conflict check was old. The solution was to

  1. Mark the PR as Draft.
  2. Publish PR again.

This triggered the Merge Conflict check for the PR and i was able to Complete the PR.

Wakerly answered 9/11, 2023 at 9:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.