Fossil SCM
Report the number of conflicts at the end of a merge or update and offer a hint to the user about the "fossil undo" command.
Commit
070ce24d838a6278fd4af9fca26a559bacc79677
Parent
76ae862ec9ee2be…
2 files changed
+5
-4
+15
-1
+5
-4
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -436,14 +436,15 @@ | ||
| 436 | 436 | db_finalize(&q); |
| 437 | 437 | |
| 438 | 438 | |
| 439 | 439 | /* Report on conflicts |
| 440 | 440 | */ |
| 441 | - if( nConflict ){ | |
| 442 | - printf("WARNING: %d merge conflicts.\n" | |
| 443 | - " ... Use \"fossil undo\" to back out this merge\n", | |
| 444 | - nConflict); | |
| 441 | + if( nConflict && !nochangeFlag ){ | |
| 442 | + printf( | |
| 443 | + "WARNING: merge conflicts - see messages above for details.\n" | |
| 444 | + "HINT: The \"fossil undo\" command will back out this merge if " | |
| 445 | + "you want\n"); | |
| 445 | 446 | } |
| 446 | 447 | |
| 447 | 448 | /* |
| 448 | 449 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 449 | 450 | */ |
| 450 | 451 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -436,14 +436,15 @@ | |
| 436 | db_finalize(&q); |
| 437 | |
| 438 | |
| 439 | /* Report on conflicts |
| 440 | */ |
| 441 | if( nConflict ){ |
| 442 | printf("WARNING: %d merge conflicts.\n" |
| 443 | " ... Use \"fossil undo\" to back out this merge\n", |
| 444 | nConflict); |
| 445 | } |
| 446 | |
| 447 | /* |
| 448 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 449 | */ |
| 450 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -436,14 +436,15 @@ | |
| 436 | db_finalize(&q); |
| 437 | |
| 438 | |
| 439 | /* Report on conflicts |
| 440 | */ |
| 441 | if( nConflict && !nochangeFlag ){ |
| 442 | printf( |
| 443 | "WARNING: merge conflicts - see messages above for details.\n" |
| 444 | "HINT: The \"fossil undo\" command will back out this merge if " |
| 445 | "you want\n"); |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 450 | */ |
| 451 |
+15
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -65,10 +65,11 @@ | ||
| 65 | 65 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 66 | 66 | int debugFlag; /* --debug option */ |
| 67 | 67 | int nChng; /* Number of file renames */ |
| 68 | 68 | int *aChng; /* Array of file renames */ |
| 69 | 69 | int i; /* Loop counter */ |
| 70 | + int nConflict; /* Number of merge conflicts */ | |
| 70 | 71 | |
| 71 | 72 | url_proxy_options(); |
| 72 | 73 | latestFlag = find_option("latest",0, 0)!=0; |
| 73 | 74 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 74 | 75 | verboseFlag = find_option("verbose","v",0)!=0; |
| @@ -287,10 +288,11 @@ | ||
| 287 | 288 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 288 | 289 | /* Conflict. This file has been added to the current checkout |
| 289 | 290 | ** but also exists in the target checkout. Use the current version. |
| 290 | 291 | */ |
| 291 | 292 | printf("CONFLICT %s\n", zName); |
| 293 | + nConflict++; | |
| 292 | 294 | }else if( idt>0 && idv==0 ){ |
| 293 | 295 | /* File added in the target. */ |
| 294 | 296 | printf("ADD %s\n", zName); |
| 295 | 297 | undo_save(zName); |
| 296 | 298 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| @@ -311,11 +313,12 @@ | ||
| 311 | 313 | ** as an addition */ |
| 312 | 314 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 313 | 315 | }else if( chnged ){ |
| 314 | 316 | /* Edited locally but deleted from the target. Do not track the |
| 315 | 317 | ** file but keep the edited version around. */ |
| 316 | - printf("CONFLICT %s\n", zName); | |
| 318 | + printf("CONFLICT %s - edited locally but deleted by update\n", zName); | |
| 319 | + nConflict++; | |
| 317 | 320 | }else{ |
| 318 | 321 | printf("REMOVE %s\n", zName); |
| 319 | 322 | undo_save(zName); |
| 320 | 323 | if( !nochangeFlag ) unlink(zFullPath); |
| 321 | 324 | } |
| @@ -336,14 +339,16 @@ | ||
| 336 | 339 | rc = blob_merge(&v, &e, &t, &r); |
| 337 | 340 | if( rc>=0 ){ |
| 338 | 341 | if( !nochangeFlag ) blob_write_to_file(&r, zFullNewPath); |
| 339 | 342 | if( rc>0 ){ |
| 340 | 343 | printf("***** %d merge conflicts in %s\n", rc, zNewName); |
| 344 | + nConflict++; | |
| 341 | 345 | } |
| 342 | 346 | }else{ |
| 343 | 347 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 344 | 348 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 349 | + nConflict++; | |
| 345 | 350 | } |
| 346 | 351 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 347 | 352 | blob_reset(&v); |
| 348 | 353 | blob_reset(&e); |
| 349 | 354 | blob_reset(&t); |
| @@ -359,10 +364,19 @@ | ||
| 359 | 364 | free(zFullNewPath); |
| 360 | 365 | } |
| 361 | 366 | db_finalize(&q); |
| 362 | 367 | printf("--------------\n"); |
| 363 | 368 | show_common_info(tid, "updated-to:", 1, 0); |
| 369 | + | |
| 370 | + /* Report on conflicts | |
| 371 | + */ | |
| 372 | + if( nConflict && !nochangeFlag ){ | |
| 373 | + printf( | |
| 374 | + "WARNING: merge conflicts - see messages above for details.\n" | |
| 375 | + "HINT: The \"fossil undo\" command will back out this update if " | |
| 376 | + "you want\n"); | |
| 377 | + } | |
| 364 | 378 | |
| 365 | 379 | /* |
| 366 | 380 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 367 | 381 | */ |
| 368 | 382 | if( nochangeFlag ){ |
| 369 | 383 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -65,10 +65,11 @@ | |
| 65 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 66 | int debugFlag; /* --debug option */ |
| 67 | int nChng; /* Number of file renames */ |
| 68 | int *aChng; /* Array of file renames */ |
| 69 | int i; /* Loop counter */ |
| 70 | |
| 71 | url_proxy_options(); |
| 72 | latestFlag = find_option("latest",0, 0)!=0; |
| 73 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 74 | verboseFlag = find_option("verbose","v",0)!=0; |
| @@ -287,10 +288,11 @@ | |
| 287 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 288 | /* Conflict. This file has been added to the current checkout |
| 289 | ** but also exists in the target checkout. Use the current version. |
| 290 | */ |
| 291 | printf("CONFLICT %s\n", zName); |
| 292 | }else if( idt>0 && idv==0 ){ |
| 293 | /* File added in the target. */ |
| 294 | printf("ADD %s\n", zName); |
| 295 | undo_save(zName); |
| 296 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| @@ -311,11 +313,12 @@ | |
| 311 | ** as an addition */ |
| 312 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 313 | }else if( chnged ){ |
| 314 | /* Edited locally but deleted from the target. Do not track the |
| 315 | ** file but keep the edited version around. */ |
| 316 | printf("CONFLICT %s\n", zName); |
| 317 | }else{ |
| 318 | printf("REMOVE %s\n", zName); |
| 319 | undo_save(zName); |
| 320 | if( !nochangeFlag ) unlink(zFullPath); |
| 321 | } |
| @@ -336,14 +339,16 @@ | |
| 336 | rc = blob_merge(&v, &e, &t, &r); |
| 337 | if( rc>=0 ){ |
| 338 | if( !nochangeFlag ) blob_write_to_file(&r, zFullNewPath); |
| 339 | if( rc>0 ){ |
| 340 | printf("***** %d merge conflicts in %s\n", rc, zNewName); |
| 341 | } |
| 342 | }else{ |
| 343 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 344 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 345 | } |
| 346 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 347 | blob_reset(&v); |
| 348 | blob_reset(&e); |
| 349 | blob_reset(&t); |
| @@ -359,10 +364,19 @@ | |
| 359 | free(zFullNewPath); |
| 360 | } |
| 361 | db_finalize(&q); |
| 362 | printf("--------------\n"); |
| 363 | show_common_info(tid, "updated-to:", 1, 0); |
| 364 | |
| 365 | /* |
| 366 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 367 | */ |
| 368 | if( nochangeFlag ){ |
| 369 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -65,10 +65,11 @@ | |
| 65 | int verboseFlag; /* -v or --verbose. Output extra information */ |
| 66 | int debugFlag; /* --debug option */ |
| 67 | int nChng; /* Number of file renames */ |
| 68 | int *aChng; /* Array of file renames */ |
| 69 | int i; /* Loop counter */ |
| 70 | int nConflict; /* Number of merge conflicts */ |
| 71 | |
| 72 | url_proxy_options(); |
| 73 | latestFlag = find_option("latest",0, 0)!=0; |
| 74 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 75 | verboseFlag = find_option("verbose","v",0)!=0; |
| @@ -287,10 +288,11 @@ | |
| 288 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 289 | /* Conflict. This file has been added to the current checkout |
| 290 | ** but also exists in the target checkout. Use the current version. |
| 291 | */ |
| 292 | printf("CONFLICT %s\n", zName); |
| 293 | nConflict++; |
| 294 | }else if( idt>0 && idv==0 ){ |
| 295 | /* File added in the target. */ |
| 296 | printf("ADD %s\n", zName); |
| 297 | undo_save(zName); |
| 298 | if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0); |
| @@ -311,11 +313,12 @@ | |
| 313 | ** as an addition */ |
| 314 | db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv); |
| 315 | }else if( chnged ){ |
| 316 | /* Edited locally but deleted from the target. Do not track the |
| 317 | ** file but keep the edited version around. */ |
| 318 | printf("CONFLICT %s - edited locally but deleted by update\n", zName); |
| 319 | nConflict++; |
| 320 | }else{ |
| 321 | printf("REMOVE %s\n", zName); |
| 322 | undo_save(zName); |
| 323 | if( !nochangeFlag ) unlink(zFullPath); |
| 324 | } |
| @@ -336,14 +339,16 @@ | |
| 339 | rc = blob_merge(&v, &e, &t, &r); |
| 340 | if( rc>=0 ){ |
| 341 | if( !nochangeFlag ) blob_write_to_file(&r, zFullNewPath); |
| 342 | if( rc>0 ){ |
| 343 | printf("***** %d merge conflicts in %s\n", rc, zNewName); |
| 344 | nConflict++; |
| 345 | } |
| 346 | }else{ |
| 347 | if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 348 | printf("***** Cannot merge binary file %s\n", zNewName); |
| 349 | nConflict++; |
| 350 | } |
| 351 | if( nameChng && !nochangeFlag ) unlink(zFullPath); |
| 352 | blob_reset(&v); |
| 353 | blob_reset(&e); |
| 354 | blob_reset(&t); |
| @@ -359,10 +364,19 @@ | |
| 364 | free(zFullNewPath); |
| 365 | } |
| 366 | db_finalize(&q); |
| 367 | printf("--------------\n"); |
| 368 | show_common_info(tid, "updated-to:", 1, 0); |
| 369 | |
| 370 | /* Report on conflicts |
| 371 | */ |
| 372 | if( nConflict && !nochangeFlag ){ |
| 373 | printf( |
| 374 | "WARNING: merge conflicts - see messages above for details.\n" |
| 375 | "HINT: The \"fossil undo\" command will back out this update if " |
| 376 | "you want\n"); |
| 377 | } |
| 378 | |
| 379 | /* |
| 380 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 381 | */ |
| 382 | if( nochangeFlag ){ |
| 383 |