Diff
Not logged in

Differences From:

File src/update.c part of check-in [6607844a01] - Added options to the "timeline" CLI command. Additional help comments. by drh on 2007-08-18 11:42:24. [view]

To:

File src/update.c part of check-in [fcabd4774c] - Improvements to the CLI timeline display. When an update fails due to multiple descendents, show all of the descendents in timeline format. by drh on 2007-09-13 03:52:04. Also file src/update.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]

@@ -68,15 +68,26 @@
     }
   }else{
     compute_leaves(vid);
     if( db_int(0, "SELECT count(*) FROM leaves")>1 ){
-      fossil_fatal("multiple descendents");
+      db_prepare(&q,
+        "SELECT blob.rid, uuid, datetime(event.mtime,'localtime'),"
+        "       comment || ' (by ' || user || ')', 1, 1"
+        "  FROM event, blob"
+        " WHERE event.type='ci' AND blob.rid=event.objid"
+        "   AND event.objid IN leaves"
+        " ORDER BY event.mtime DESC"
+      );
+      print_timeline(&q, 100);
+      db_finalize(&q);
+      fossil_fatal("Multiple descendents");
     }
     tid = db_int(0, "SELECT rid FROM leaves");
   }
 
   db_begin_transaction();
   vfile_check_signature(vid);
+  undo_begin();
   load_vfile_from_rid(tid);
 
   /*
   ** The record.fn field is used to match files against each other.  The
@@ -144,19 +155,22 @@
       printf("CONFLICT %s\n", zName);
     }else if( idt>0 && idv==0 ){
       /* File added in the target. */
       printf("ADD %s\n", zName);
+      undo_save(zName);
       vfile_to_disk(0, idt, 0);
     }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){
       /* The file is unedited.  Change it to the target version */
       printf("UPDATE %s\n", zName);
+      undo_save(zName);
       vfile_to_disk(0, idt, 0);
     }else if( idt==0 && idv>0 ){
       if( chnged ){
         printf("CONFLICT %s\n", zName);
       }else{
         char *zFullPath;
         printf("REMOVE %s\n", zName);
+        undo_save(zName);
         zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
         unlink(zFullPath);
         free(zFullPath);
       }
@@ -164,8 +178,9 @@
       /* Merge the changes in the current tree into the target version */
       Blob e, r, t, v;
       char *zFullPath;
       printf("MERGE %s\n", zName);
+      undo_save(zName);
       zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
       content_get(ridt, &t);
       content_get(ridv, &v);
       blob_zero(&e);