Fossil SCM

Improved robustness of the merge algorithm when merging long-running branches with many name changes.

drh 2021-04-20 14:16 trunk
Commit dc850c9b3b2d7e9e49413cb1a3759ad73faec86db552e4297809d8dd927abca6
1 file changed +8 -4
+8 -4
--- src/merge.c
+++ src/merge.c
@@ -598,10 +598,14 @@
598598
** Compute name changes from N to V, P, and M
599599
*/
600600
add_renames("fn", vid, nid, 0, debugFlag ? "N->V" : 0);
601601
add_renames("fnp", pid, nid, 0, debugFlag ? "N->P" : 0);
602602
add_renames("fnm", mid, nid, backoutFlag, debugFlag ? "N->M" : 0);
603
+ if( debugFlag ){
604
+ fossil_print("******** FV after name change search *******\n");
605
+ debug_fv_dump(1);
606
+ }
603607
if( nid!=pid ){
604608
/* See forum thread https://fossil-scm.org/forum/forumpost/549700437b
605609
**
606610
** If a filename changes between nid and one of the other check-ins
607611
** pid, vid, or mid, then it might not have changed for all of them.
@@ -615,33 +619,33 @@
615619
** The Fossil merge algorithm breaks down in those cases. It will need
616620
** to be completely rewritten to handle such complex cases. Such cases
617621
** appear to be rare, and also confusing to humans.
618622
*/
619623
db_multi_exec(
620
- "UPDATE fv SET fn=vfile.pathname FROM vfile"
624
+ "UPDATE OR IGNORE fv SET fn=vfile.pathname FROM vfile"
621625
" WHERE fn IS NULL"
622626
" AND vfile.pathname IN (fv.fnm,fv.fnp,fv.fnn)"
623627
" AND vfile.vid=%d;",
624628
vid
625629
);
626630
db_multi_exec(
627
- "UPDATE fv SET fnp=vfile.pathname FROM vfile"
631
+ "UPDATE OR IGNORE fv SET fnp=vfile.pathname FROM vfile"
628632
" WHERE fnp IS NULL"
629633
" AND vfile.pathname IN (fv.fn,fv.fnm,fv.fnn)"
630634
" AND vfile.vid=%d;",
631635
pid
632636
);
633637
db_multi_exec(
634
- "UPDATE fv SET fnm=vfile.pathname FROM vfile"
638
+ "UPDATE OR IGNORE fv SET fnm=vfile.pathname FROM vfile"
635639
" WHERE fnm IS NULL"
636640
" AND vfile.pathname IN (fv.fn,fv.fnp,fv.fnn)"
637641
" AND vfile.vid=%d;",
638642
mid
639643
);
640644
}
641645
if( debugFlag ){
642
- fossil_print("******** FV after name change search *******\n");
646
+ fossil_print("******** FV after name change fill-in *******\n");
643647
debug_fv_dump(1);
644648
}
645649
646650
/*
647651
** Add files found in V
648652
--- src/merge.c
+++ src/merge.c
@@ -598,10 +598,14 @@
598 ** Compute name changes from N to V, P, and M
599 */
600 add_renames("fn", vid, nid, 0, debugFlag ? "N->V" : 0);
601 add_renames("fnp", pid, nid, 0, debugFlag ? "N->P" : 0);
602 add_renames("fnm", mid, nid, backoutFlag, debugFlag ? "N->M" : 0);
 
 
 
 
603 if( nid!=pid ){
604 /* See forum thread https://fossil-scm.org/forum/forumpost/549700437b
605 **
606 ** If a filename changes between nid and one of the other check-ins
607 ** pid, vid, or mid, then it might not have changed for all of them.
@@ -615,33 +619,33 @@
615 ** The Fossil merge algorithm breaks down in those cases. It will need
616 ** to be completely rewritten to handle such complex cases. Such cases
617 ** appear to be rare, and also confusing to humans.
618 */
619 db_multi_exec(
620 "UPDATE fv SET fn=vfile.pathname FROM vfile"
621 " WHERE fn IS NULL"
622 " AND vfile.pathname IN (fv.fnm,fv.fnp,fv.fnn)"
623 " AND vfile.vid=%d;",
624 vid
625 );
626 db_multi_exec(
627 "UPDATE fv SET fnp=vfile.pathname FROM vfile"
628 " WHERE fnp IS NULL"
629 " AND vfile.pathname IN (fv.fn,fv.fnm,fv.fnn)"
630 " AND vfile.vid=%d;",
631 pid
632 );
633 db_multi_exec(
634 "UPDATE fv SET fnm=vfile.pathname FROM vfile"
635 " WHERE fnm IS NULL"
636 " AND vfile.pathname IN (fv.fn,fv.fnp,fv.fnn)"
637 " AND vfile.vid=%d;",
638 mid
639 );
640 }
641 if( debugFlag ){
642 fossil_print("******** FV after name change search *******\n");
643 debug_fv_dump(1);
644 }
645
646 /*
647 ** Add files found in V
648
--- src/merge.c
+++ src/merge.c
@@ -598,10 +598,14 @@
598 ** Compute name changes from N to V, P, and M
599 */
600 add_renames("fn", vid, nid, 0, debugFlag ? "N->V" : 0);
601 add_renames("fnp", pid, nid, 0, debugFlag ? "N->P" : 0);
602 add_renames("fnm", mid, nid, backoutFlag, debugFlag ? "N->M" : 0);
603 if( debugFlag ){
604 fossil_print("******** FV after name change search *******\n");
605 debug_fv_dump(1);
606 }
607 if( nid!=pid ){
608 /* See forum thread https://fossil-scm.org/forum/forumpost/549700437b
609 **
610 ** If a filename changes between nid and one of the other check-ins
611 ** pid, vid, or mid, then it might not have changed for all of them.
@@ -615,33 +619,33 @@
619 ** The Fossil merge algorithm breaks down in those cases. It will need
620 ** to be completely rewritten to handle such complex cases. Such cases
621 ** appear to be rare, and also confusing to humans.
622 */
623 db_multi_exec(
624 "UPDATE OR IGNORE fv SET fn=vfile.pathname FROM vfile"
625 " WHERE fn IS NULL"
626 " AND vfile.pathname IN (fv.fnm,fv.fnp,fv.fnn)"
627 " AND vfile.vid=%d;",
628 vid
629 );
630 db_multi_exec(
631 "UPDATE OR IGNORE fv SET fnp=vfile.pathname FROM vfile"
632 " WHERE fnp IS NULL"
633 " AND vfile.pathname IN (fv.fn,fv.fnm,fv.fnn)"
634 " AND vfile.vid=%d;",
635 pid
636 );
637 db_multi_exec(
638 "UPDATE OR IGNORE fv SET fnm=vfile.pathname FROM vfile"
639 " WHERE fnm IS NULL"
640 " AND vfile.pathname IN (fv.fn,fv.fnp,fv.fnn)"
641 " AND vfile.vid=%d;",
642 mid
643 );
644 }
645 if( debugFlag ){
646 fossil_print("******** FV after name change fill-in *******\n");
647 debug_fv_dump(1);
648 }
649
650 /*
651 ** Add files found in V
652

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button