volleynerd

I know this subject has come up a few times in the forum, and I've read the answers to those - but still not sure I'm following the answer.

I am following an admittedly old webcast from TechEd 2005 by Douglas Neumann that talks about TFS Promotion Modeling, and the ability to Cherry-Pick merge a particular changeset. I'm wondering has something changed since the beta when this seemingly worked


Very similar to the demo, I have the following setup:
DEV branched to QA (changeset 29)

DEV
class1.cs

QA
class1.cs


Make a change to class1.cs and check it in
+ add new property called "NewFeature" for the next release (changeset 30)

Make another change to class1.cs for a bug fix and check it in
+ add new property called "BugFix", need this in the QA branch. (changeset 31)


Now, Cherry Pick Merge DEV to QA, selecting only changeset 31.
(*should* only contain the new BugFix property)


Get Conflict error saying "The source and target both have changes"
Note that nothing has changed in the target branch (QA).

Thank you in advance for any help.
-Dan





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

The conflict is by design. Cherry-pick merges will almost always result in version conflicts because the base version (30 in your case) is different from the target version (29). Without this conflict the wrong changes would be written to target.

The error message could be better. Not all version conflicts are the result of changes on both sides.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

volleynerd

Thanks for the reply Richard.

I'm not sure I see why the wrong changes would be written to the target (if this was NOT considered a conflict).

The goal here is to merge the DIFF between changeset 30 and 31 in the DEV line (the couple lines of code that make up the "bug fix") into the QA branch. Why is the base version (30) in play if I'm doing a cherry-pick merge I would think it is only in play to compute the DIFF, then merge that diff contents to the branch version. However it sounds like it's using 30 to compare to the branched version 29 and seeing a difference.

Based on most of the demos / webcasts / articles I've seen from the MS camp, the claim is that Cherry-Pick merging is supported, and that this type of promotion modeling from DEV -> QA -> PROD is the best practice for TFS. If cherry-pick merges will almost always result in version conflicts, then I must be missing something - why they are discussed in all the examples of being supported. When I saw this TFS promotion modeling pattern, along with Cherry-Pick merging support, I thought we would no longer have to manually update N branches of code when making a bug fix in the midst of continuing feature development.

Any additional thoughts on how to achieve the best practices - supporting bug fixes in the DEV line, being able to promote those fixes only to upstream branches

Thanks again for the help!
-Dan





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

Merge in TFS does a lot more than just generate diffs. The same logic that tells us we need to use C30 as the base for an eventual 3-way content diff is used throughout the whole operation. For example, we need to calculate the correct namespace operation(s) to pend: if C30 had contained a rename, a cherry-pick of C31 would need to pend the edit on target\oldName, while a rename inside the version range would require us to bring the new name into the target.

I don't think our recommendation was to use cherry-picking for everything. It strikes me as something that should be the exception rather than the rule. After all, when you test builds out of the DEV branch, you're testing all changes up to some point, and promotion modeling generally requires that you only promote things that have been tested (up to some quality/confidence level appropriate for that stage). Given that model, cherry-picking is for high-priority fixes that need to sidestep the formal process.

Still, there's nothing wrong with your way. Just to be clear: there is nothing bad or unusual about version conflicts. It's just our signal to the user that something needs their attention.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

volleynerd

Thanks Richard - your explanation / logic definitely clears up some of my misunderstanding.

I guess some of the confusion comes from the Resolve Conflicts dialog. The Compare - Source to Base... option is in fact the diff content that we're talking about wanting to merge into the QA branch. So conceptually, this is the difference between 30 and 31 in my example.

I understand when you say that the version conflict is a signal that something needs my attention, but then I wonder why I can't confirm/choose that source to base diff as the intended results for the merge

Since I can't use the Merge Tool (disabled in the dialog), should I just be manually editing the file in pending checkins list before committing the merge

And even if I *do* manually fix the conflicts, then commit them... I have to do a /force merge later when doing the "catchup" merge for the promotion of the next version to QA so it doesn't skip the bug fix I already cherry-picked. (and this merge has it's own content conflict - in this case I choose Copy Item from source branch and all is well)

Again, thank you for your help!
-Dan






Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

You should be able to click Auto Merge All on the main Resolve dialog. Also, the top two options in the Resolve Conflict dialog (Merge Changes in Merge Tool and Merge Changes For Me) should both work. It's strange that the Merge Tool option would be disabled -- what kind of file is it

Be very careful about manually editing the file outside the Resolve process. Manual editing is ok if you choose AcceptMerge, but will screw up debit/credit calculation if you do it while choosing AcceptYours or AcceptTheirs.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

volleynerd

OK - right - this is where something weird is going on, probably causing most of my confusion. Both "Merge changes for me" (auto merge) and "Merge changes in merge tool" are disabled for me. If either/both were enabled, I would have chosen those and probably been ok with the functionality.

The file is just straight .cs text.

I have created a very short screen-cast of the scenario. Hopefully you can take a look and see what I mean.

Posted to Channel9 sandbox here: CherryPickMergeCantResolveConflict
(Save link at the bottom has the zip/video file)

Thank you Richard!





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

Definitely a bug in the Resolve dialog. I've only seen it barf like that in corner cases, though, never a simple merge like yours.

"Good" news is it didn't repro on my machine. Try SP1 first, let me know if it's still broken.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

volleynerd

If by SP1 you mean VS 2005 sp1, I have that on the client machine where I did the screencast.

On the client where I'm doing the merge:

Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)

I don't have VS 2005 on the TF server (workgroup edition in a VPC in my case with just TF and Team Explorer), so haven't applied SP1 there - is that needed






Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

No -- there's a separate download to upgrade the server, but that wouldn't help what we're seeing here.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

volleynerd

I installed the VS 2005 TFS SP1 anyway on the server, no change.

Also this morning tried:
  • the same scenario from a co-worker's machine, to see if there was something funny with my client. (that client also has VS05 SP1 installed)
  • the same scenario with my client against a full version of TFS (instead of my VPC running Workgroup version), brand new Team Project, new VS project created in version control, new branch, new attempted merge...
Both resulted in the same issue/outcome - no option to merge with the merge tool in the resolve conflicts dialog.







Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

Can you turn on logging

Add this to devenv.exe.config:

<appSettings>
<add key="VersionControl.EnableSoapTracing" value="true" />
<add key="VersionControl.TraceDownloadContent" value="false" />
</appSettings>
<system.diagnostics>
<switches>
<add name="VersionControl" value="4" />
</switches>
<trace autoflush="true" indentsize="3">
<listeners>
<add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
initializeData="d:\logs\devenv.log" />
</listeners>
</trace>
</system.diagnostics>

Change d:\logs\devenv.log to some text file where your account has write permission.

Open VS, run File -> Source Control -> Resume Conflict Resolution to bring the Resolve Conflicts dialog back up, then click into the inner Resolve dialog as before. That should be enough to generate the logs we need.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

mercuryworm

I have been also seeing the two options "Merge changes for me" and "Merge changes in merge tool" disabled with all the developers where I am working. The only time the two options are enabled is if I have already merged the files externally prior to trying to checkin.

I don't know if this matters but we have the exclusive checkout policy on. Not my choice.

The situation this comes up in is when I go to the file system and make a file writeable so I can make changes to it when the person who has it checked out is sick or on vacation. When the other person comes back and checks in their changes, I can check out the file and check in my changes but the system won't let me merge changes because thoes options are disabled.





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

Richard Berg MSFT

It may indeed be related to exclusive checkout. I noticed that Dan's logging data indicated exclusive locks. Can you follow the same steps to turn on logging All I need is the QueryConflictsResponse. Should look something like this:

<QueryConflictsResponse xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/VersionControl/ClientServices/03">

<QueryConflictsResult>

<Conflict cid="45" pcid="-444" ychg="None" ysitem="$/DeleteMe/ClassLibrary1-QA/Class3.cs" ysitemsrc="$/DeleteMe/ClassLibrary1-QA/Class3.cs" yenc="1252" ytype="File" yver="70" yitemid="224" ydid="0" ylchg="None" ylmver="70" bsitem="$/DeleteMe/ClassLibrary1/Class3.cs" benc="1252" bitemid="161" bver="71" bhash="9yZtAgZsfJGLoER34cxTXw==" bdid="0" btype="File" bchg="Edit Merge Lock" titemid="161" tver="72" tsitem="$/DeleteMe/ClassLibrary1/Class3.cs" tenc="1252" thash="h6UmGpAZdDWvyKmmJ7wscg==" tdid="0" ttype="File" tlmver="33" srclitem="D:\Projects\IK\Internal\TFS\Code\TFS\Workspace_DeleteMe_User\ClassLibrary1-QA\Class3.cs" tgtlitem="D:\Projects\IK\Internal\TFS\Code\TFS\Workspace_DeleteMe_User\ClassLibrary1-QA\Class3.cs" ctype="Merge" reason="0" isnamecflict="false" isforced="false" isresolved="false" bdurl="sfid=1228,1230,1171,0,0,0,0,0,0,0&amp;ts=633064802805319184&amp;s=Ss4agcKr9E2L6%2FlpLwrnO3XY9Xfj%2BNB8m%2Brua81hzOR9d57I9LyHXc34gzpsbqKeA3E5Ruedv0875bsqrrpZlxbTCs1NAsshOkS8PRLinduttQbI9t6iIuLKh0FLqbXk7K4tIT3bcbUaG2GCZpoM7BII53DpK1xupmPUGlppJOc%3D&amp;fid=1228" tdurl="sfid=1228,1230,1171,0,0,0,0,0,0,0&amp;ts=633064802805319184&amp;s=Ss4agcKr9E2L6%2FlpLwrnO3XY9Xfj%2BNB8m%2Brua81hzOR9d57I9LyHXc34gzpsbqKeA3E5Ruedv0875bsqrrpZlxbTCs1NAsshOkS8PRLinduttQbI9t6iIuLKh0FLqbXk7K4tIT3bcbUaG2GCZpoM7BII53DpK1xupmPUGlppJOc%3D&amp;fid=1230" ydurl="sfid=1228,1230,1171,0,0,0,0,0,0,0&amp;ts=633064802805319184&amp;s=Ss4agcKr9E2L6%2FlpLwrnO3XY9Xfj%2BNB8m%2Brua81hzOR9d57I9LyHXc34gzpsbqKeA3E5Ruedv0875bsqrrpZlxbTCs1NAsshOkS8PRLinduttQbI9t6iIuLKh0FLqbXk7K4tIT3bcbUaG2GCZpoM7BII53DpK1xupmPUGlppJOc%3D&amp;fid=1171" />

</QueryConflictsResult>

</QueryConflictsResponse>





Re: Team Foundation Server - Version Control Cherry Pick Merge causes conflict

mercuryworm

<QueryConflictsResponse xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/VersionControl/ClientServices/03">
<QueryConflictsResult>
<Conflict cid="11321" pcid="-246454" ychg="Edit Lock" ysitem="$/Team Project/WEB PROJECTS/External - Extranet/DotNet/Currents/FHCF/FHCFsolution2005/FHCFEntities/ORBusiness/FHCFInvoice/FHCFInvoice_Claim.vb" ysitemsrc="$/Team Project/WEB PROJECTS/External - Extranet/DotNet/Currents/FHCF/FHCFsolution2005/FHCFEntities/ORBusiness/FHCFInvoice/FHCFInvoice_Claim.vb" yenc="1252" ytype="File" yver="30681" yitemid="63577" ydid="0" ylchg="None" ylmver="0" bsitem="$/Team Project/WEB PROJECTS/External - Extranet/DotNet/Currents/FHCF/FHCFsolution2005/FHCFEntities/ORBusiness/FHCFInvoice/FHCFInvoice_Claim.vb" benc="1252" bitemid="63577" bver="30681" bhash="V8fLUWIbjh3PYVSf6EG7Jg==" bdid="0" btype="File" bchg="Edit" titemid="63577" tver="58101" tsitem="$/Team Project/WEB PROJECTS/External - Extranet/DotNet/Currents/FHCF/FHCFsolution2005/FHCFEntities/ORBusiness/FHCFInvoice/FHCFInvoice_Claim.vb" tenc="1252" thash="kDwzhtOkmHtUOYLkLGiYCw==" tdid="0" ttype="File" tlmver="0" srclitem="C:\working\FHCF\FHCFsolution2005\FHCFEntities\ORBusiness\FHCFInvoice\FHCFInvoice_Claim.vb" tgtlitem="C:\working\FHCF\FHCFsolution2005\FHCFEntities\ORBusiness\FHCFInvoice\FHCFInvoice_Claim.vb" ctype="Checkin" reason="0" isnamecflict="false" isforced="false" isresolved="false" bdurl="sfid=190109,328243,328245,309988,0,0,0,0,0,0&amp;ts=633066297387797535&amp;s=DwDqrA%2Fh8vTtaAZf%2FM75h5aGr%2B%2FB2EZYm9i4t%2B8h%2FLGBJ39qCGZTOONt8gkcN4gbpfV0TgOW%2B9auujUiM6xSSYiFjjFraBeFhsrp6ZWIIj4NDhmu5lwEkNsAtUoGrGPXo0FYcLjR9AhJmbuALYyTHbUDliC3pXHfHIiWV8qDAdc%3D&amp;fid=190109" tdurl="sfid=190109,328243,328245,309988,0,0,0,0,0,0&amp;ts=633066297387797535&amp;s=DwDqrA%2Fh8vTtaAZf%2FM75h5aGr%2B%2FB2EZYm9i4t%2B8h%2FLGBJ39qCGZTOONt8gkcN4gbpfV0TgOW%2B9auujUiM6xSSYiFjjFraBeFhsrp6ZWIIj4NDhmu5lwEkNsAtUoGrGPXo0FYcLjR9AhJmbuALYyTHbUDliC3pXHfHIiWV8qDAdc%3D&amp;fid=328243" ydurl="sfid=190109,328243,328245,309988,0,0,0,0,0,0&amp;ts=633066297387797535&amp;s=DwDqrA%2Fh8vTtaAZf%2FM75h5aGr%2B%2FB2EZYm9i4t%2B8h%2FLGBJ39qCGZTOONt8gkcN4gbpfV0TgOW%2B9auujUiM6xSSYiFjjFraBeFhsrp6ZWIIj4NDhmu5lwEkNsAtUoGrGPXo0FYcLjR9AhJmbuALYyTHbUDliC3pXHfHIiWV8qDAdc%3D&amp;fid=328245" />
</QueryConflictsResult>
</QueryConflictsResponse>