Fossil SCM

Produce merge conflict mark during merge when file exist in current version and in version to be merged, but not in common ancestor. Related forum discussion including test script: [forum:f035bbc8461da6d2].

mgagnon 2023-03-16 02:08 trunk
Commit 04e1674c75b1cb4f47470d7e331c316475f3692b7cf23d0de5c72cdbf1587f38
1 file changed +6 -19
+6 -19
--- src/merge.c
+++ src/merge.c
@@ -762,28 +762,11 @@
762762
763763
/************************************************************************
764764
** All of the information needed to do the merge is now contained in the
765765
** FV table. Starting here, we begin to actually carry out the merge.
766766
**
767
- ** First, find files in M and V but not in P and report conflicts.
768
- ** The file in M will be ignored. It will be treated as if it
769
- ** does not exist.
770
- */
771
- db_prepare(&q,
772
- "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0"
773
- );
774
- while( db_step(&q)==SQLITE_ROW ){
775
- int idm = db_column_int(&q, 0);
776
- char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm);
777
- fossil_warning("WARNING: no common ancestor for %s", zName);
778
- free(zName);
779
- db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm);
780
- }
781
- db_finalize(&q);
782
-
783
- /*
784
- ** Find files that have changed from P->M but not P->V.
767
+ ** First, find files that have changed from P->M but not P->V.
785768
** Copy the M content over into V.
786769
*/
787770
db_prepare(&q,
788771
"SELECT idv, ridm, fn, islinkm FROM fv"
789772
" WHERE idp>0 AND idv>0 AND idm>0"
@@ -809,14 +792,18 @@
809792
}
810793
db_finalize(&q);
811794
812795
/*
813796
** Do a three-way merge on files that have changes on both P->M and P->V.
797
+ **
798
+ ** Proceed even if the file doesn't exist on P, just like the common ancestor
799
+ ** of M and V is an empty file. In this case, merge conflict marks will be
800
+ ** added to the file and user will be forced to take a decision.
814801
*/
815802
db_prepare(&q,
816803
"SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm FROM fv"
817
- " WHERE idp>0 AND idv>0 AND idm>0"
804
+ " WHERE idv>0 AND idm>0"
818805
" AND ridm!=ridp AND (ridv!=ridp OR chnged)",
819806
glob_expr("fv.fn", zBinGlob)
820807
);
821808
while( db_step(&q)==SQLITE_ROW ){
822809
int ridm = db_column_int(&q, 0);
823810
--- src/merge.c
+++ src/merge.c
@@ -762,28 +762,11 @@
762
763 /************************************************************************
764 ** All of the information needed to do the merge is now contained in the
765 ** FV table. Starting here, we begin to actually carry out the merge.
766 **
767 ** First, find files in M and V but not in P and report conflicts.
768 ** The file in M will be ignored. It will be treated as if it
769 ** does not exist.
770 */
771 db_prepare(&q,
772 "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0"
773 );
774 while( db_step(&q)==SQLITE_ROW ){
775 int idm = db_column_int(&q, 0);
776 char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm);
777 fossil_warning("WARNING: no common ancestor for %s", zName);
778 free(zName);
779 db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm);
780 }
781 db_finalize(&q);
782
783 /*
784 ** Find files that have changed from P->M but not P->V.
785 ** Copy the M content over into V.
786 */
787 db_prepare(&q,
788 "SELECT idv, ridm, fn, islinkm FROM fv"
789 " WHERE idp>0 AND idv>0 AND idm>0"
@@ -809,14 +792,18 @@
809 }
810 db_finalize(&q);
811
812 /*
813 ** Do a three-way merge on files that have changes on both P->M and P->V.
 
 
 
 
814 */
815 db_prepare(&q,
816 "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm FROM fv"
817 " WHERE idp>0 AND idv>0 AND idm>0"
818 " AND ridm!=ridp AND (ridv!=ridp OR chnged)",
819 glob_expr("fv.fn", zBinGlob)
820 );
821 while( db_step(&q)==SQLITE_ROW ){
822 int ridm = db_column_int(&q, 0);
823
--- src/merge.c
+++ src/merge.c
@@ -762,28 +762,11 @@
762
763 /************************************************************************
764 ** All of the information needed to do the merge is now contained in the
765 ** FV table. Starting here, we begin to actually carry out the merge.
766 **
767 ** First, find files that have changed from P->M but not P->V.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768 ** Copy the M content over into V.
769 */
770 db_prepare(&q,
771 "SELECT idv, ridm, fn, islinkm FROM fv"
772 " WHERE idp>0 AND idv>0 AND idm>0"
@@ -809,14 +792,18 @@
792 }
793 db_finalize(&q);
794
795 /*
796 ** Do a three-way merge on files that have changes on both P->M and P->V.
797 **
798 ** Proceed even if the file doesn't exist on P, just like the common ancestor
799 ** of M and V is an empty file. In this case, merge conflict marks will be
800 ** added to the file and user will be forced to take a decision.
801 */
802 db_prepare(&q,
803 "SELECT ridm, idv, ridp, ridv, %s, fn, isexe, islinkv, islinkm FROM fv"
804 " WHERE idv>0 AND idm>0"
805 " AND ridm!=ridp AND (ridv!=ridp OR chnged)",
806 glob_expr("fv.fn", zBinGlob)
807 );
808 while( db_step(&q)==SQLITE_ROW ){
809 int ridm = db_column_int(&q, 0);
810

Keyboard Shortcuts

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