| | @@ -217,19 +217,20 @@ |
| 217 | 217 | " islinkv BOOLEAN," /* True if current file is a link */ |
| 218 | 218 | " islinkt BOOLEAN," /* True if target file is a link */ |
| 219 | 219 | " ridv INTEGER," /* Record ID for current version */ |
| 220 | 220 | " ridt INTEGER," /* Record ID for target */ |
| 221 | 221 | " isexe BOOLEAN," /* Does target have execute permission? */ |
| 222 | + " deleted BOOLEAN DEFAULT 0,"/* File marke by "rm" to become unmanaged */ |
| 222 | 223 | " fnt TEXT" /* Filename of same file on target version */ |
| 223 | 224 | ");" |
| 224 | 225 | ); |
| 225 | 226 | |
| 226 | 227 | /* Add files found in the current version |
| 227 | 228 | */ |
| 228 | 229 | db_multi_exec( |
| 229 | | - "INSERT OR IGNORE INTO fv(fn,fnt,idv,idt,ridv,ridt,isexe,chnged)" |
| 230 | | - " SELECT pathname, pathname, id, 0, rid, 0, isexe, chnged" |
| 230 | + "INSERT OR IGNORE INTO fv(fn,fnt,idv,idt,ridv,ridt,isexe,chnged,deleted)" |
| 231 | + " SELECT pathname, pathname, id, 0, rid, 0, isexe, chnged, deleted" |
| 231 | 232 | " FROM vfile WHERE vid=%d", |
| 232 | 233 | vid |
| 233 | 234 | ); |
| 234 | 235 | |
| 235 | 236 | /* Compute file name changes on V->T. Record name changes in files that |
| | @@ -339,11 +340,11 @@ |
| 339 | 340 | ** Alter the content of the checkout so that it conforms with the |
| 340 | 341 | ** target |
| 341 | 342 | */ |
| 342 | 343 | db_prepare(&q, |
| 343 | 344 | "SELECT fn, idv, ridv, idt, ridt, chnged, fnt," |
| 344 | | - " isexe, islinkv, islinkt FROM fv ORDER BY 1" |
| 345 | + " isexe, islinkv, islinkt, deleted FROM fv ORDER BY 1" |
| 345 | 346 | ); |
| 346 | 347 | db_prepare(&mtimeXfer, |
| 347 | 348 | "UPDATE vfile SET mtime=(SELECT mtime FROM vfile WHERE id=:idv)" |
| 348 | 349 | " WHERE id=:idt" |
| 349 | 350 | ); |
| | @@ -359,43 +360,52 @@ |
| 359 | 360 | int chnged = db_column_int(&q, 5); /* Current is edited */ |
| 360 | 361 | const char *zNewName = db_column_text(&q,6);/* New filename */ |
| 361 | 362 | int isexe = db_column_int(&q, 7); /* EXE perm for new file */ |
| 362 | 363 | int islinkv = db_column_int(&q, 8); /* Is current file is a link */ |
| 363 | 364 | int islinkt = db_column_int(&q, 9); /* Is target file is a link */ |
| 365 | + int deleted = db_column_int(&q, 10); /* Marked for deletion */ |
| 364 | 366 | char *zFullPath; /* Full pathname of the file */ |
| 365 | 367 | char *zFullNewPath; /* Full pathname of dest */ |
| 366 | 368 | char nameChng; /* True if the name changed */ |
| 367 | 369 | |
| 368 | 370 | zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 369 | 371 | zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); |
| 370 | 372 | nameChng = fossil_strcmp(zName, zNewName); |
| 371 | 373 | nUpdate++; |
| 374 | + if( deleted ){ |
| 375 | + db_multi_exec("UPDATE vfile SET deleted=1 WHERE id=%d", idt); |
| 376 | + } |
| 372 | 377 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 373 | 378 | /* Conflict. This file has been added to the current checkout |
| 374 | 379 | ** but also exists in the target checkout. Use the current version. |
| 375 | 380 | */ |
| 376 | 381 | fossil_print("CONFLICT %s\n", zName); |
| 377 | 382 | nConflict++; |
| 378 | 383 | }else if( idt>0 && idv==0 ){ |
| 379 | 384 | /* File added in the target. */ |
| 380 | 385 | if( file_wd_isfile_or_link(zFullPath) ){ |
| 381 | | - fossil_print("ADD %s (overwrites an unmanaged file)\n", zName); |
| 386 | + fossil_print("ADD %s - overwrites an unmanaged file\n", zName); |
| 382 | 387 | nOverwrite++; |
| 383 | 388 | }else{ |
| 384 | 389 | fossil_print("ADD %s\n", zName); |
| 385 | 390 | } |
| 386 | 391 | undo_save(zName); |
| 387 | 392 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 388 | | - }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){ |
| 393 | + }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){ |
| 389 | 394 | /* The file is unedited. Change it to the target version */ |
| 390 | 395 | undo_save(zName); |
| 391 | | - fossil_print("UPDATE %s\n", zName); |
| 396 | + if( deleted ){ |
| 397 | + fossil_print("UPDATE %s - change to unmanged file\n", zName); |
| 398 | + }else{ |
| 399 | + fossil_print("UPDATE %s\n", zName); |
| 400 | + } |
| 392 | 401 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 393 | 402 | }else if( idt>0 && idv>0 && file_wd_size(zFullPath)<0 ){ |
| 394 | 403 | /* The file missing from the local check-out. Restore it to the |
| 395 | 404 | ** version that appears in the target. */ |
| 396 | | - fossil_print("UPDATE %s\n", zName); |
| 405 | + fossil_print("UPDATE %s%s\n", zName, |
| 406 | + deleted?" - change to unmanaged file":""); |
| 397 | 407 | undo_save(zName); |
| 398 | 408 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 399 | 409 | }else if( idt==0 && idv>0 ){ |
| 400 | 410 | if( ridv==0 ){ |
| 401 | 411 | /* Added in current checkout. Continue to hold the file as |
| 402 | 412 | |
| 403 | 413 | ADDED test/update-test-1.sh |
| 404 | 414 | ADDED test/update-test-2.sh |