12.07.2015 Views

To-and-Fro Merging

To-and-Fro Merging

To-and-Fro Merging

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>To</strong>-<strong>and</strong>-<strong>Fro</strong> <strong>Merging</strong>Julian FoadWANdisco, plc


Contents➔What's wrong with sync <strong>and</strong> reintegrate?Why symmetric?Continue after reintegrateHow do sync <strong>and</strong> reintegrate work?SurpriseImplementationLimitationsResults & Plans


30merging with v1.7


Graph notationPPQPQRPQRSTediteditreintegratePSPQSPQSTPQRSTcp + editsynceditsync


40symmetric merging


furtherdevelopment


ContentsWhat's wrong with sync <strong>and</strong> reintegrate?➔ Why symmetric?Continue after reintegrateHow do sync <strong>and</strong> reintegrate work?ImplementationLimitationsResults


46 – Any common ancestor


ContentsWhat's wrong with sync <strong>and</strong> reintegrate?Why symmetric?➔ Continue after reintegrateHow do sync <strong>and</strong> reintegrate work?ImplementationResults


55.1


55.2


We can use the same merge comm<strong>and</strong>


We can continue after reintegrate


ContentsWhat's wrong with sync <strong>and</strong> reintegrate?➔How do sync <strong>and</strong> reintegrate work?ImplementationResults


Graph notation


Sync- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil


Sync- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”


Sync- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”- Youngest Common Ancestor: O- all source changes: A1, A2, A3, A4- target's mergeinfo about source: “A:1-2”


Sync- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”- Youngest Common Ancestor: O- all source changes: A1, A2, A3, A4- target's mergeinfo about source: “A:1-2”- eligible changes: A3, A4- 3-way merge,base: pred(A3)right: A4- record mergeinfo: “A:3-4”


Reintegrate- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”- Youngest Common Ancestor: O- all target changes: A1, A2, A3, A4- source's mergeinfo about target: “A:1-2”- last target change merged to source: A2


Reintegrate- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”- Youngest Common Ancestor: O- all target changes: A1, A2, A3, A4- source's mergeinfo about target: “A:1-2”- last target change merged to source: A2- eligible change: diff(A2, B4)- 3-way merge,base: A2right: B4


Reintegrate- Youngest Common Ancestor: O- all changes on source: A1, A2- target's mergeinfo about source: nil- eligible changes: A1, A2- 3-way merge,base: pred(A1)right: A2- record mergeinfo: “A:1-2”- Youngest Common Ancestor: O- all target changes: A1, A2, A3, A4- source's mergeinfo about target: “A:1-2”- last target change merged to source: A2- eligible change: diff(A2, B4)- 3-way merge,base: A2right: B4- record mergeinfo: “B:1-4”


DifferencesBase node issync: on source branchreintegrate: on target branchSync:can skip cherry-picked revscan fill in subtree mergescan h<strong>and</strong>le local mods in the WCReintegrate:can't


Surprisesvn 1.7 merges just work


Surprisesvn 1.7 merges just work


ContentsWhat's wrong with sync <strong>and</strong> reintegrate?How do sync <strong>and</strong> reintegrate work?➔ImplementationLimitationsResults & Plans


Symmetric algorithmFind the best base●Find the latest rev of A synced to B <strong>and</strong> of B synced to A.●Choose the more recent base.Then, ideally...●Identify cherry-picks.●Break into 3-way merges, skipping the cherry-picks.●Perform the 3-way merges <strong>and</strong> mergeinfo addition.but currently...– Run “sync” if base on source– Run “reintegrate” if base on target


Symmetric algorithmFind the best base●Find the latest rev of A synced to B <strong>and</strong> of B synced to A.* Find 'BASE', such that* all changes on SOURCE_BRANCH after YCA up to <strong>and</strong> including BASE* are recorded in TARGET_MERGEINFO.** BASE* o­­­­­­­o­­­­­­­­­­­­­­­ SOURCE_BRANCH* / \* ­­­­­o prev. \* YCA \ merges \* o­­­­­­­­­­­o­­­­­­­­­­­


Symmetric algorithmFind the best base●Find the latest rev of A synced to B <strong>and</strong> of B synced to A.* In terms of mergeinfo:** Source a­­... o=change, ­=no­op revision* branch / \* YCA ­­> o a­­­o­­­o­­­o­­­o­­­ d=delete, a=add­as­a­copy** Eligible ­.eee.eeeeeeeeeeeeeeeeeeee .=not a source branch location** Tgt­mi ­.mmm.mmmmm­­­­­­­m­­­­­­­ m=merged, ­=not merged** Eligible ­.­­­.­­­­­eeeeeee­eeeeeee** Next ­­­­­­­­­­­^­­­­­­­­­­­­­­ BASE is just before here.


Symmetric algorithmLimitations●●Merge code is not symmetric insideOnly same-direction-again merges can h<strong>and</strong>le...● cherry-picks, subtrees, local mods, sparse WC, ...


A foot-noteMore stable branchLess stable branch


Results


Results+ svn merge ­­reintegrate '^/B' A­­­ <strong>Merging</strong> differences between repository URLsinto 'A':AA/pickle­­­ Recording mergeinfo for merge betweenrepository URLs into 'A':UA+ svn ci ­m ''SendingAddingAA/pickleCommitted revision 6.+ svn up ­q+ svn merge '^/B' A­­­ <strong>Merging</strong> differences between repository URLsinto 'A':AA/pickle­­­ Recording mergeinfo for merge betweenrepository URLs into 'A':UA+ svn ci ­m ''SendingAddingAA/pickleCommitted revision 6.+ svn up ­q+ svn merge '^/A' B­­­ <strong>Merging</strong> r5 through r6 into 'B':C B/pickle­­­ Recording mergeinfo for merge of r5 throughr6 into 'B':UBSummary of conflicts:Tree conflicts: 1+ svn merge '^/A' B­­­ Recording mergeinfo for merge betweenrepository URLs into 'B':UB


ResultsIn the current state:✔✔Never need to specify “--reintegrate” optionKeep using a dev branch after reintegrating it


PlansBefore releasable:●●●●Support sub-tree mergeinfo●to the extent that 1.7 doesRemove “--symmetric” optionInvoke symmetric code automaticallyDeprecate “--reintegrate” option


PlansOther:●●●Rewrite merge code to be symmetric inside?●not for user benefit, but for developmentUsability tweaks●error if target unrelated to sourceTackle renames

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!