Fossil SCM

Make sync errors more obvious by issuing a warning at the end of the operation if errors occur.

andybradford 2026-03-25 05:32 trunk
Commit cae9c9085879e1faf05a48c56053dceaf189b110aea9f2bf7c41596c0bb26a94
1 file changed +16 -3
+16 -3
--- src/sync.c
+++ src/sync.c
@@ -355,10 +355,17 @@
355355
*pSyncFlags |= SYNC_ALLURL;
356356
}
357357
}
358358
}
359359
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
+}
360367
361368
/*
362369
** COMMAND: pull
363370
**
364371
** Usage: %fossil pull ?URL? ?options?
@@ -399,20 +406,22 @@
399406
void pull_cmd(void){
400407
unsigned configFlags = 0;
401408
unsigned syncFlags = SYNC_PULL;
402409
unsigned urlOmitFlags = 0;
403410
const char *zAltPCode = find_option("project-code",0,1);
411
+ int nErr;
404412
if( find_option("from-parent-project",0,0)!=0 ){
405413
syncFlags |= SYNC_FROMPARENT;
406414
}
407415
if( zAltPCode ) urlOmitFlags = URL_REMEMBER;
408416
process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags);
409417
410418
/* We should be done with options.. */
411419
verify_all_options();
412420
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"); }
414423
}
415424
416425
/*
417426
** COMMAND: push
418427
**
@@ -450,19 +459,21 @@
450459
** See also: [[clone]], [[config]], [[pull]], [[remote]], [[sync]]
451460
*/
452461
void push_cmd(void){
453462
unsigned configFlags = 0;
454463
unsigned syncFlags = SYNC_PUSH;
464
+ int nErr;
455465
process_sync_args(&configFlags, &syncFlags, 0, 0);
456466
457467
/* We should be done with options.. */
458468
verify_all_options();
459469
460470
if( db_get_boolean("dont-push",0) ){
461471
fossil_fatal("pushing is prohibited: the 'dont-push' option is set");
462472
}
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"); }
464475
}
465476
466477
467478
/*
468479
** COMMAND: sync
@@ -504,10 +515,11 @@
504515
** See also: [[clone]], [[pull]], [[push]], [[remote]]
505516
*/
506517
void sync_cmd(void){
507518
unsigned configFlags = 0;
508519
unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
520
+ int nErr;
509521
if( find_option("unversioned","u",0)!=0 ){
510522
syncFlags |= SYNC_UNVERSIONED;
511523
}
512524
if( find_option("ping",0,0)!=0 ){
513525
syncFlags = SYNC_PING;
@@ -524,11 +536,12 @@
524536
if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
525537
if( (syncFlags & SYNC_PUSH)==0 ){
526538
fossil_warning("pull only: the 'dont-push' option is set");
527539
}
528540
}
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"); }
530543
}
531544
532545
/*
533546
** Handle the "fossil unversioned sync" and "fossil unversioned revert"
534547
** commands.
535548
--- 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

Keyboard Shortcuts

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