Fossil SCM
Make sync errors more obvious by issuing a warning at the end of the operation if errors occur.
Commit
cae9c9085879e1faf05a48c56053dceaf189b110aea9f2bf7c41596c0bb26a94
Parent
e40bdbff497c135…
1 file changed
+16
-3
+16
-3
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -355,10 +355,17 @@ | ||
| 355 | 355 | *pSyncFlags |= SYNC_ALLURL; |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | +/* | |
| 361 | +* Wrapper method around fossil_warning for sync errors takes single | |
| 362 | +* argument for the operation (e.g. sync, pull, push). | |
| 363 | +*/ | |
| 364 | +static void sync_errors(const char *zOp){ | |
| 365 | + fossil_warning("Warning: see above for errors encountered during %s.", zOp); | |
| 366 | +} | |
| 360 | 367 | |
| 361 | 368 | /* |
| 362 | 369 | ** COMMAND: pull |
| 363 | 370 | ** |
| 364 | 371 | ** Usage: %fossil pull ?URL? ?options? |
| @@ -399,20 +406,22 @@ | ||
| 399 | 406 | void pull_cmd(void){ |
| 400 | 407 | unsigned configFlags = 0; |
| 401 | 408 | unsigned syncFlags = SYNC_PULL; |
| 402 | 409 | unsigned urlOmitFlags = 0; |
| 403 | 410 | const char *zAltPCode = find_option("project-code",0,1); |
| 411 | + int nErr; | |
| 404 | 412 | if( find_option("from-parent-project",0,0)!=0 ){ |
| 405 | 413 | syncFlags |= SYNC_FROMPARENT; |
| 406 | 414 | } |
| 407 | 415 | if( zAltPCode ) urlOmitFlags = URL_REMEMBER; |
| 408 | 416 | process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags); |
| 409 | 417 | |
| 410 | 418 | /* We should be done with options.. */ |
| 411 | 419 | verify_all_options(); |
| 412 | 420 | |
| 413 | - client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode); | |
| 421 | + nErr = client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode); | |
| 422 | + if( nErr ){ sync_errors("pull"); } | |
| 414 | 423 | } |
| 415 | 424 | |
| 416 | 425 | /* |
| 417 | 426 | ** COMMAND: push |
| 418 | 427 | ** |
| @@ -450,19 +459,21 @@ | ||
| 450 | 459 | ** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]] |
| 451 | 460 | */ |
| 452 | 461 | void push_cmd(void){ |
| 453 | 462 | unsigned configFlags = 0; |
| 454 | 463 | unsigned syncFlags = SYNC_PUSH; |
| 464 | + int nErr; | |
| 455 | 465 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 456 | 466 | |
| 457 | 467 | /* We should be done with options.. */ |
| 458 | 468 | verify_all_options(); |
| 459 | 469 | |
| 460 | 470 | if( db_get_boolean("dont-push",0) ){ |
| 461 | 471 | fossil_fatal("pushing is prohibited: the 'dont-push' option is set"); |
| 462 | 472 | } |
| 463 | - client_sync_all_urls(syncFlags, 0, 0, 0); | |
| 473 | + nErr = client_sync_all_urls(syncFlags, 0, 0, 0); | |
| 474 | + if( nErr ){ sync_errors("push"); } | |
| 464 | 475 | } |
| 465 | 476 | |
| 466 | 477 | |
| 467 | 478 | /* |
| 468 | 479 | ** COMMAND: sync |
| @@ -504,10 +515,11 @@ | ||
| 504 | 515 | ** See also: [[clone]], [[pull]], [[push]], [[remote]] |
| 505 | 516 | */ |
| 506 | 517 | void sync_cmd(void){ |
| 507 | 518 | unsigned configFlags = 0; |
| 508 | 519 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 520 | + int nErr; | |
| 509 | 521 | if( find_option("unversioned","u",0)!=0 ){ |
| 510 | 522 | syncFlags |= SYNC_UNVERSIONED; |
| 511 | 523 | } |
| 512 | 524 | if( find_option("ping",0,0)!=0 ){ |
| 513 | 525 | syncFlags = SYNC_PING; |
| @@ -524,11 +536,12 @@ | ||
| 524 | 536 | if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; |
| 525 | 537 | if( (syncFlags & SYNC_PUSH)==0 ){ |
| 526 | 538 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 527 | 539 | } |
| 528 | 540 | } |
| 529 | - client_sync_all_urls(syncFlags, configFlags, 0, 0); | |
| 541 | + nErr = client_sync_all_urls(syncFlags, configFlags, 0, 0); | |
| 542 | + if( nErr ){ sync_errors("sync"); } | |
| 530 | 543 | } |
| 531 | 544 | |
| 532 | 545 | /* |
| 533 | 546 | ** Handle the "fossil unversioned sync" and "fossil unversioned revert" |
| 534 | 547 | ** commands. |
| 535 | 548 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -355,10 +355,17 @@ | |
| 355 | *pSyncFlags |= SYNC_ALLURL; |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | |
| 361 | /* |
| 362 | ** COMMAND: pull |
| 363 | ** |
| 364 | ** Usage: %fossil pull ?URL? ?options? |
| @@ -399,20 +406,22 @@ | |
| 399 | void pull_cmd(void){ |
| 400 | unsigned configFlags = 0; |
| 401 | unsigned syncFlags = SYNC_PULL; |
| 402 | unsigned urlOmitFlags = 0; |
| 403 | const char *zAltPCode = find_option("project-code",0,1); |
| 404 | if( find_option("from-parent-project",0,0)!=0 ){ |
| 405 | syncFlags |= SYNC_FROMPARENT; |
| 406 | } |
| 407 | if( zAltPCode ) urlOmitFlags = URL_REMEMBER; |
| 408 | process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags); |
| 409 | |
| 410 | /* We should be done with options.. */ |
| 411 | verify_all_options(); |
| 412 | |
| 413 | client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode); |
| 414 | } |
| 415 | |
| 416 | /* |
| 417 | ** COMMAND: push |
| 418 | ** |
| @@ -450,19 +459,21 @@ | |
| 450 | ** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]] |
| 451 | */ |
| 452 | void push_cmd(void){ |
| 453 | unsigned configFlags = 0; |
| 454 | unsigned syncFlags = SYNC_PUSH; |
| 455 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 456 | |
| 457 | /* We should be done with options.. */ |
| 458 | verify_all_options(); |
| 459 | |
| 460 | if( db_get_boolean("dont-push",0) ){ |
| 461 | fossil_fatal("pushing is prohibited: the 'dont-push' option is set"); |
| 462 | } |
| 463 | client_sync_all_urls(syncFlags, 0, 0, 0); |
| 464 | } |
| 465 | |
| 466 | |
| 467 | /* |
| 468 | ** COMMAND: sync |
| @@ -504,10 +515,11 @@ | |
| 504 | ** See also: [[clone]], [[pull]], [[push]], [[remote]] |
| 505 | */ |
| 506 | void sync_cmd(void){ |
| 507 | unsigned configFlags = 0; |
| 508 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 509 | if( find_option("unversioned","u",0)!=0 ){ |
| 510 | syncFlags |= SYNC_UNVERSIONED; |
| 511 | } |
| 512 | if( find_option("ping",0,0)!=0 ){ |
| 513 | syncFlags = SYNC_PING; |
| @@ -524,11 +536,12 @@ | |
| 524 | if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; |
| 525 | if( (syncFlags & SYNC_PUSH)==0 ){ |
| 526 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 527 | } |
| 528 | } |
| 529 | client_sync_all_urls(syncFlags, configFlags, 0, 0); |
| 530 | } |
| 531 | |
| 532 | /* |
| 533 | ** Handle the "fossil unversioned sync" and "fossil unversioned revert" |
| 534 | ** commands. |
| 535 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -355,10 +355,17 @@ | |
| 355 | *pSyncFlags |= SYNC_ALLURL; |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | /* |
| 361 | * Wrapper method around fossil_warning for sync errors takes single |
| 362 | * argument for the operation (e.g. sync, pull, push). |
| 363 | */ |
| 364 | static void sync_errors(const char *zOp){ |
| 365 | fossil_warning("Warning: see above for errors encountered during %s.", zOp); |
| 366 | } |
| 367 | |
| 368 | /* |
| 369 | ** COMMAND: pull |
| 370 | ** |
| 371 | ** Usage: %fossil pull ?URL? ?options? |
| @@ -399,20 +406,22 @@ | |
| 406 | void pull_cmd(void){ |
| 407 | unsigned configFlags = 0; |
| 408 | unsigned syncFlags = SYNC_PULL; |
| 409 | unsigned urlOmitFlags = 0; |
| 410 | const char *zAltPCode = find_option("project-code",0,1); |
| 411 | int nErr; |
| 412 | if( find_option("from-parent-project",0,0)!=0 ){ |
| 413 | syncFlags |= SYNC_FROMPARENT; |
| 414 | } |
| 415 | if( zAltPCode ) urlOmitFlags = URL_REMEMBER; |
| 416 | process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags); |
| 417 | |
| 418 | /* We should be done with options.. */ |
| 419 | verify_all_options(); |
| 420 | |
| 421 | nErr = client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode); |
| 422 | if( nErr ){ sync_errors("pull"); } |
| 423 | } |
| 424 | |
| 425 | /* |
| 426 | ** COMMAND: push |
| 427 | ** |
| @@ -450,19 +459,21 @@ | |
| 459 | ** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]] |
| 460 | */ |
| 461 | void push_cmd(void){ |
| 462 | unsigned configFlags = 0; |
| 463 | unsigned syncFlags = SYNC_PUSH; |
| 464 | int nErr; |
| 465 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 466 | |
| 467 | /* We should be done with options.. */ |
| 468 | verify_all_options(); |
| 469 | |
| 470 | if( db_get_boolean("dont-push",0) ){ |
| 471 | fossil_fatal("pushing is prohibited: the 'dont-push' option is set"); |
| 472 | } |
| 473 | nErr = client_sync_all_urls(syncFlags, 0, 0, 0); |
| 474 | if( nErr ){ sync_errors("push"); } |
| 475 | } |
| 476 | |
| 477 | |
| 478 | /* |
| 479 | ** COMMAND: sync |
| @@ -504,10 +515,11 @@ | |
| 515 | ** See also: [[clone]], [[pull]], [[push]], [[remote]] |
| 516 | */ |
| 517 | void sync_cmd(void){ |
| 518 | unsigned configFlags = 0; |
| 519 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 520 | int nErr; |
| 521 | if( find_option("unversioned","u",0)!=0 ){ |
| 522 | syncFlags |= SYNC_UNVERSIONED; |
| 523 | } |
| 524 | if( find_option("ping",0,0)!=0 ){ |
| 525 | syncFlags = SYNC_PING; |
| @@ -524,11 +536,12 @@ | |
| 536 | if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; |
| 537 | if( (syncFlags & SYNC_PUSH)==0 ){ |
| 538 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 539 | } |
| 540 | } |
| 541 | nErr = client_sync_all_urls(syncFlags, configFlags, 0, 0); |
| 542 | if( nErr ){ sync_errors("sync"); } |
| 543 | } |
| 544 | |
| 545 | /* |
| 546 | ** Handle the "fossil unversioned sync" and "fossil unversioned revert" |
| 547 | ** commands. |
| 548 |