Diff
Not logged in

Differences From:

File src/update.c part of check-in [1d9ebd9e4a] - Add --nochanges and --verbose options to the "update" command. Tickets 4d6b7d4e1 and 7a27e10f1fe. by drh on 2009-12-17 16:17:11. [view]

To:

File src/update.c part of check-in [d861fe77fb] - If a file in the check-out is changed to something other than a file (like a directory) then raise an error when checking file signatures. Also fix a problem with the new multi-file "revert" command and add some comments to "update". by drh on 2009-12-17 18:47:14. [view]

@@ -165,14 +165,14 @@
   db_prepare(&q,
     "SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1"
   );
   while( db_step(&q)==SQLITE_ROW ){
-    const char *zName = db_column_text(&q, 0);
-    int idv = db_column_int(&q, 1);
-    int ridv = db_column_int(&q, 2);
-    int idt = db_column_int(&q, 3);
-    int ridt = db_column_int(&q, 4);
-    int chnged = db_column_int(&q, 5);
+    const char *zName = db_column_text(&q, 0);  /* The filename */
+    int idv = db_column_int(&q, 1);             /* VFILE entry for current */
+    int ridv = db_column_int(&q, 2);            /* RecordID for current */
+    int idt = db_column_int(&q, 3);             /* VFILE entry for target */
+    int ridt = db_column_int(&q, 4);            /* RecordID for target */
+    int chnged = db_column_int(&q, 5);          /* Current is edited */
 
     if( idv>0 && ridv==0 && idt>0 ){
       /* Conflict.  This file has been added to the current checkout
       ** but also exists in the target checkout.  Use the current version.
@@ -302,11 +302,13 @@
   Blob fname;
   Blob record;
   Blob ans;
   int i;
-  int rid = 0, yesRevert;
+  int rid = 0;
+  int yesFlag;
+  int yesRevert;
 
-  yesRevert = find_option("yes", "y", 0)!=0;
+  yesFlag = find_option("yes", "y", 0)!=0;
   zRevision = find_option("revision", "r", 1);
   verify_all_options();
 
   if( g.argc<3 ){
@@ -316,9 +318,10 @@
 
   for(i=2; i<g.argc; i++){
     zFile = mprintf("%/", g.argv[i]);
     file_tree_name(zFile, &fname, 1);
-    if( access(zFile, 0) ) yesRevert = 1;
+    yesRevert = yesFlag;
+    if( !yesRevert && access(zFile, 0) ) yesRevert = 1;
     if( yesRevert==0 ){
       char *prompt = mprintf("revert file %B? this will"
                              " destroy local changes (y/N)? ",
                              &fname);