| | @@ -207,19 +207,20 @@ |
| 207 | 207 | " idt INTEGER," /* VFILE entry for target version */ |
| 208 | 208 | " chnged BOOLEAN," /* True if current version has been edited */ |
| 209 | 209 | " ridv INTEGER," /* Record ID for current version */ |
| 210 | 210 | " ridt INTEGER," /* Record ID for target */ |
| 211 | 211 | " isexe BOOLEAN," /* Does target have execute permission? */ |
| 212 | + " deleted BOOLEAN DEFAULT 0,"/* File marke by "rm" to become unmanaged */ |
| 212 | 213 | " fnt TEXT" /* Filename of same file on target version */ |
| 213 | 214 | ");" |
| 214 | 215 | ); |
| 215 | 216 | |
| 216 | 217 | /* Add files found in the current version |
| 217 | 218 | */ |
| 218 | 219 | db_multi_exec( |
| 219 | | - "INSERT OR IGNORE INTO fv(fn,fnt,idv,idt,ridv,ridt,isexe,chnged)" |
| 220 | | - " SELECT pathname, pathname, id, 0, rid, 0, isexe, chnged" |
| 220 | + "INSERT OR IGNORE INTO fv(fn,fnt,idv,idt,ridv,ridt,isexe,chnged,deleted)" |
| 221 | + " SELECT pathname, pathname, id, 0, rid, 0, isexe, chnged, deleted" |
| 221 | 222 | " FROM vfile WHERE vid=%d", |
| 222 | 223 | vid |
| 223 | 224 | ); |
| 224 | 225 | |
| 225 | 226 | /* Compute file name changes on V->T. Record name changes in files that |
| | @@ -311,11 +312,12 @@ |
| 311 | 312 | /* |
| 312 | 313 | ** Alter the content of the checkout so that it conforms with the |
| 313 | 314 | ** target |
| 314 | 315 | */ |
| 315 | 316 | db_prepare(&q, |
| 316 | | - "SELECT fn, idv, ridv, idt, ridt, chnged, fnt, isexe FROM fv ORDER BY 1" |
| 317 | + "SELECT fn, idv, ridv, idt, ridt, chnged, fnt," |
| 318 | + " isexe, deleted FROM fv ORDER BY 1" |
| 317 | 319 | ); |
| 318 | 320 | db_prepare(&mtimeXfer, |
| 319 | 321 | "UPDATE vfile SET mtime=(SELECT mtime FROM vfile WHERE id=:idv)" |
| 320 | 322 | " WHERE id=:idt" |
| 321 | 323 | ); |
| | @@ -329,17 +331,21 @@ |
| 329 | 331 | int idt = db_column_int(&q, 3); /* VFILE entry for target */ |
| 330 | 332 | int ridt = db_column_int(&q, 4); /* RecordID for target */ |
| 331 | 333 | int chnged = db_column_int(&q, 5); /* Current is edited */ |
| 332 | 334 | const char *zNewName = db_column_text(&q,6);/* New filename */ |
| 333 | 335 | int isexe = db_column_int(&q, 7); /* EXE perm for new file */ |
| 336 | + int deleted = db_column_int(&q, 8); /* Marked for deletion */ |
| 334 | 337 | char *zFullPath; /* Full pathname of the file */ |
| 335 | 338 | char *zFullNewPath; /* Full pathname of dest */ |
| 336 | 339 | char nameChng; /* True if the name changed */ |
| 337 | 340 | |
| 338 | 341 | zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 339 | 342 | zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); |
| 340 | 343 | nameChng = fossil_strcmp(zName, zNewName); |
| 344 | + if( deleted ){ |
| 345 | + db_multi_exec("UPDATE vfile SET deleted=1 WHERE id=%d", idt); |
| 346 | + } |
| 341 | 347 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 342 | 348 | /* Conflict. This file has been added to the current checkout |
| 343 | 349 | ** but also exists in the target checkout. Use the current version. |
| 344 | 350 | */ |
| 345 | 351 | fossil_print("CONFLICT %s\n", zName); |
| | @@ -347,19 +353,24 @@ |
| 347 | 353 | }else if( idt>0 && idv==0 ){ |
| 348 | 354 | /* File added in the target. */ |
| 349 | 355 | fossil_print("ADD %s\n", zName); |
| 350 | 356 | undo_save(zName); |
| 351 | 357 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 352 | | - }else if( idt>0 && idv>0 && ridt!=ridv && chnged==0 ){ |
| 358 | + }else if( idt>0 && idv>0 && ridt!=ridv && (chnged==0 || deleted) ){ |
| 353 | 359 | /* The file is unedited. Change it to the target version */ |
| 354 | 360 | undo_save(zName); |
| 355 | | - fossil_print("UPDATE %s\n", zName); |
| 361 | + if( deleted ){ |
| 362 | + fossil_print("UPDATE %s - change to unmanged file\n", zName); |
| 363 | + }else{ |
| 364 | + fossil_print("UPDATE %s\n", zName); |
| 365 | + } |
| 356 | 366 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 357 | 367 | }else if( idt>0 && idv>0 && file_size(zFullPath)<0 ){ |
| 358 | 368 | /* The file missing from the local check-out. Restore it to the |
| 359 | 369 | ** version that appears in the target. */ |
| 360 | | - fossil_print("UPDATE %s\n", zName); |
| 370 | + fossil_print("UPDATE %s%s\n", zName, |
| 371 | + deleted?" - change to unmanaged file":""); |
| 361 | 372 | undo_save(zName); |
| 362 | 373 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| 363 | 374 | }else if( idt==0 && idv>0 ){ |
| 364 | 375 | if( ridv==0 ){ |
| 365 | 376 | /* Added in current checkout. Continue to hold the file as |
| 366 | 377 | |
| 367 | 378 | ADDED test/update-test-1.sh |
| 368 | 379 | ADDED test/update-test-2.sh |