Diff
Not logged in

Differences From:

File src/update.c part of check-in [7eecb079ed] - Cleanup of the safemerge flag on update. Override available using the --force option. by drh on 2007-09-26 16:20:41. [view]

To:

File src/update.c part of check-in [36b96b8616] - Rework the merge algorithm. It now only works for text files. But, it no longer gets confused by line endings (\r\n versus \n) and it reports conflicts. by drh on 2007-11-16 20:42:31. [view]

@@ -207,8 +207,9 @@
       }
     }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){
       /* Merge the changes in the current tree into the target version */
       Blob e, r, t, v;
+      int rc;
       char *zFullPath;
       printf("MERGE %s\n", zName);
       undo_save(zName);
       zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
@@ -215,15 +216,23 @@
       content_get(ridt, &t);
       content_get(ridv, &v);
       blob_zero(&e);
       blob_read_from_file(&e, zFullPath);
-      blob_merge(&v, &e, &t, &r);
-      blob_write_to_file(&r, zFullPath);
+      rc = blob_merge(&v, &e, &t, &r);
+      if( rc>=0 ){
+        blob_write_to_file(&r, zFullPath);
+        if( rc>0 ){
+          printf("***** %d merge conflicts in %s\n", rc, zName);
+        }
+      }else{
+        printf("***** Cannot merge binary file %s\n", zName);
+      }
       free(zFullPath);
       blob_reset(&v);
       blob_reset(&e);
       blob_reset(&t);
       blob_reset(&r);
+
     }
   }
   db_finalize(&q);