views:

81

answers:

2

Does the quality of code merged by TFS 2008 depend on the used programming language? I know merging in Java / Subversion, and merging a branch to its trunk usually does not create much conflicts. Now in my company, we use VB.NET. When I merge two files TFS does not always get code blocks right, e.g. does not find the right If..then / end if lines. To give you an example, I mean: File 2 is created as a branch of File 1. Both files were changed later, now I'm going to merge those files and am recieving conficts: The marked end-if lines (1) are detected as corresponding, meaning the added event handler Button1_Click is being deleted.

Now I wonder if this behavior is by language (C# vs. VB.NET) or are other source control solutions just better than TFS? (And I really liked TFS up to now :) )


File 1:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        Label1.Text = "Hello"
        Label2.Text = "World"
    End If
End Sub

Protected Sub Button2_Click(ByVal sender, ByVal e as System.EventArgs) Handles Button2.Click

    // ....

    If Page.IsValid Then
        Label3.Text = "Hello Button 2"
    End If

    // ....
End Sub

File 2 (Branch of File 1):

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        fillTableFromDatabase()
    End If // (1)

End Sub

Protected Sub Button1_Click(ByVal sender, ByVal e as System.EventArgs) Handles Button1.Click
    // do something here
End Sub

Protected Sub Button2_Click(ByVal sender, ByVal e as System.EventArgs) Handles Button2.Click

    // ....

    If Page.IsValid Then
    End If // (1)

    // ....
End Sub
A: 

I'd say that this was a problem with the merge algorithm in TFS rather than being a problem caused by the language.

A few years ago the firm where I worked was using Perforce and that rarely made errors when merging. The earlier versions would have a problem if two people added code to the end of the file but they'd fixed that by the time the 2005 versions had come out (in fact they might well have fixed it earlier).

ChrisF
A: 

I tested your files with a 3rd party tool (KDiff3) and obtained better results. You can switch the tools that VS 2008 uses for merging and comparing:

http://blogs.msdn.com/jmanning/articles/535573.aspx

Steve Campbell
Found the tool DiffMerge (http://www.sourcegear.com/diffmerge/) using your link. At least it seems to me that i'm getting better results with it.
paologios