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.

drh 2010-12-15 01:49 trunk
Commit 070ce24d838a6278fd4af9fca26a559bacc79677
2 files changed +5 -4 +15 -1
+5 -4
--- src/merge.c
+++ src/merge.c
@@ -436,14 +436,15 @@
436436
db_finalize(&q);
437437
438438
439439
/* Report on conflicts
440440
*/
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");
445446
}
446447
447448
/*
448449
** Clean up the mid and pid VFILE entries. Then commit the changes.
449450
*/
450451
--- 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 @@
6565
int verboseFlag; /* -v or --verbose. Output extra information */
6666
int debugFlag; /* --debug option */
6767
int nChng; /* Number of file renames */
6868
int *aChng; /* Array of file renames */
6969
int i; /* Loop counter */
70
+ int nConflict; /* Number of merge conflicts */
7071
7172
url_proxy_options();
7273
latestFlag = find_option("latest",0, 0)!=0;
7374
nochangeFlag = find_option("nochange","n",0)!=0;
7475
verboseFlag = find_option("verbose","v",0)!=0;
@@ -287,10 +288,11 @@
287288
if( idv>0 && ridv==0 && idt>0 && ridt>0 ){
288289
/* Conflict. This file has been added to the current checkout
289290
** but also exists in the target checkout. Use the current version.
290291
*/
291292
printf("CONFLICT %s\n", zName);
293
+ nConflict++;
292294
}else if( idt>0 && idv==0 ){
293295
/* File added in the target. */
294296
printf("ADD %s\n", zName);
295297
undo_save(zName);
296298
if( !nochangeFlag ) vfile_to_disk(0, idt, 0, 0);
@@ -311,11 +313,12 @@
311313
** as an addition */
312314
db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv);
313315
}else if( chnged ){
314316
/* Edited locally but deleted from the target. Do not track the
315317
** 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++;
317320
}else{
318321
printf("REMOVE %s\n", zName);
319322
undo_save(zName);
320323
if( !nochangeFlag ) unlink(zFullPath);
321324
}
@@ -336,14 +339,16 @@
336339
rc = blob_merge(&v, &e, &t, &r);
337340
if( rc>=0 ){
338341
if( !nochangeFlag ) blob_write_to_file(&r, zFullNewPath);
339342
if( rc>0 ){
340343
printf("***** %d merge conflicts in %s\n", rc, zNewName);
344
+ nConflict++;
341345
}
342346
}else{
343347
if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath);
344348
printf("***** Cannot merge binary file %s\n", zNewName);
349
+ nConflict++;
345350
}
346351
if( nameChng && !nochangeFlag ) unlink(zFullPath);
347352
blob_reset(&v);
348353
blob_reset(&e);
349354
blob_reset(&t);
@@ -359,10 +364,19 @@
359364
free(zFullNewPath);
360365
}
361366
db_finalize(&q);
362367
printf("--------------\n");
363368
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
+ }
364378
365379
/*
366380
** Clean up the mid and pid VFILE entries. Then commit the changes.
367381
*/
368382
if( nochangeFlag ){
369383
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button