Namespace conflicts while Merging

I thought I would talk about namespace conflicts while merging. A namespace conflict occurs when 2 items try to occupy the same slot in the tree. The main reasons for namespace conflicts during merge are:

- Items with the same name are created in 2 branches without a merge relationship established between them, below is an example which involves a baseless merge.
tf merge /baseless branch branch2 /r (if file.txt was added in branch, it gets branched to branch2)
tf checkin /i
tf merge branch trunk /r (file.text gets branched up to trunk)
tf checkin /i
tf merge branch2 trunk /r (since there is no merge relationship for file.txt in trunk, it gets branched to trunk)

- Another example would be if the same file was added and checked into 2 related branches.

Now that this has occurred how would you go about resolving a namespace conflict:

(assume 1.txt was added and checked in both to trunk and branch):

D:\temp_Dd\ws113>tf merge trunk branch /r 
merge, branch: $/proj/trunk/1.txt;C13 -> $/proj/branch/1.txt

D:\temp_Dd\ws113>tf checkin /i
branch:
Checking in merge, branch: 1.txt
Conflict: The item $/proj/branch/1.txt already exists.

TF10141: No files checked in: resolve the conflicts and try again.

1. If the 2 items are not related, you have the option to keep your changes and rename the file in the branch out of the way. This basically moves the existing item out of the way:

D:\temp_Dd\ws113>tf resolve branch\1.txt /auto:AcceptYoursRenameTheirs /newname:branch\2.txt
Resolved D:\temp_Dd\ws113\branch\1.txt as AcceptYoursRenameTheirs
D:\temp_Dd\ws113\branch:
Getting 2.txt

D:\temp_Dd\ws113>tf status
File name Change        Local path
--------- ------------- -------------------------------------------------------
$/proj/branch
1.txt     merge, branch D:\temp_Dd\ws113\branch\1.txt
2.txt     rename        D:\temp_Dd\ws113\branch\2.txt

2 change(s)

2. If the 2 items are related - your best option would be to undo the change and establish a relationship using /baseless. This will ensure that future merges will proceed smoothly:

D:\temp_Dd\ws113>tf merge trunk branch /r /baseless

I hope to blog soon about some improvements we have made in Orcas to improve the experience around this case.

Chandru

Comments

  • Anonymous
    April 05, 2007
    The comment has been removed
  • Anonymous
    May 22, 2007
    Based upon customer feedback(both external and internal), we have made a number of improvements to the