Diff
Not logged in

Differences From:

File src/merge.c part of check-in [4c82c7773f] - Fix some annoyances with "merge". This involves a schema change to the _FOSSIL_ file. Older versions will continue to work, but it would make since to "close" and "open" local source tree after updating to this version of fossil, in order to update the schema. by drh on 2007-08-30 20:27:14. [view]

To:

File src/merge.c part of check-in [a36177bcce] - Add the "undo" and "redo" commands. Untested at this point so don't try to use them yet. by drh on 2007-09-11 02:25:19. Also file src/merge.c part of check-in [f76192b245] - Pulled the latest CLI, website, and sqlite changes into the importer branch. by aku on 2007-09-17 01:00:32. [view]

@@ -78,8 +78,9 @@
     fossil_panic("not a version: record #%d", mid);
   }
   vfile_check_signature(vid);
   db_begin_transaction();
+  undo_begin();
   load_vfile_from_rid(mid);
   load_vfile_from_rid(pid);
 
   /*
@@ -172,16 +173,19 @@
   while( db_step(&q)==SQLITE_ROW ){
     int idm = db_column_int(&q, 0);
     int rowid = db_column_int(&q, 1);
     int idv;
+    const char *zName;
     db_multi_exec(
       "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,pathname)"
       "  SELECT %d,3,0,rid,mrid,pathname FROM vfile WHERE id=%d",
       vid, idm
     );
     idv = db_last_insert_rowid();
     db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid);
-    printf("ADDED %s\n", db_column_text(&q, 2));
+    zName = db_column_text(&q, 2);
+    printf("ADDED %s\n", zName);
+    undo_save(zName);
     vfile_to_disk(0, idm, 0);
   }
   db_finalize(&q);
 
@@ -199,8 +203,9 @@
     int ridm = db_column_int(&q, 1);
     char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idv);
     /* Copy content from idm over into idv.  Overwrite idv. */
     printf("UPDATE %s\n", zName);
+    undo_save(zName);
     db_multi_exec(
       "UPDATE vfile SET mrid=%d, chnged=2 WHERE id=%d", ridm, idv
     );
     vfile_to_disk(0, idv, 0);
@@ -224,8 +229,9 @@
     char *zFullPath;
     Blob m, p, v, r;
     /* Do a 3-way merge of idp->idm into idp->idv.  The results go into idv. */
     printf("MERGE %s\n", zName);
+    undo_save(zName);
     zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
     free(zName);
     content_get(ridp, &p);
     content_get(ridm, &m);
@@ -253,8 +259,9 @@
     int idv = db_column_int(&q, 0);
     char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idv);
     /* Delete the file idv */
     printf("DELETE %s\n", zName);
+    undo_save(zName);
     db_multi_exec(
       "UPDATE vfile SET deleted=1 WHERE id=%d", idv
     );
     free(zName);