Fossil SCM
Improve situational awareness with "fossil update" by including a messages in the changes: information if the name of the branch changes. See [forum:7f5ae505e4144a0c | forum discussion 7f5ae505e4144a0c] for details.
Commit
bb9150c403e78db3ac7665188ce4d8886180bc8accb43ca88e65613a82d7b095
Parent
106de276eec32ea…
1 file changed
+12
-3
+12
-3
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -132,10 +132,13 @@ | ||
| 132 | 132 | int nUpdate = 0; /* Number of changes of any kind */ |
| 133 | 133 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 134 | 134 | int width; /* Width of printed comment lines */ |
| 135 | 135 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 136 | 136 | const char *zWidth; /* Width option string value */ |
| 137 | + const char *zCurBrName; /* Current branch name */ | |
| 138 | + const char *zNewBrName; /* New branch name */ | |
| 139 | + const char *zBrChgMsg = ""; /* Message to display if branch changes */ | |
| 137 | 140 | |
| 138 | 141 | if( !internalUpdate ){ |
| 139 | 142 | undo_capture_command_line(); |
| 140 | 143 | url_proxy_options(); |
| 141 | 144 | } |
| @@ -163,10 +166,11 @@ | ||
| 163 | 166 | /* We should be done with options.. */ |
| 164 | 167 | verify_all_options(); |
| 165 | 168 | |
| 166 | 169 | db_must_be_within_tree(); |
| 167 | 170 | vid = db_lget_int("checkout", 0); |
| 171 | + zCurBrName = branch_of_rid(vid); | |
| 168 | 172 | user_select(); |
| 169 | 173 | if( !dryRunFlag && !internalUpdate && !bNosync ){ |
| 170 | 174 | if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){ |
| 171 | 175 | fossil_fatal("update abandoned due to sync failure"); |
| 172 | 176 | } |
| @@ -563,20 +567,25 @@ | ||
| 563 | 567 | free(zFullNewPath); |
| 564 | 568 | } |
| 565 | 569 | db_finalize(&q); |
| 566 | 570 | db_finalize(&mtimeXfer); |
| 567 | 571 | fossil_print("%.79c\n",'-'); |
| 572 | + zNewBrName = branch_of_rid(tid); | |
| 573 | + if( fossil_strcmp(zCurBrName, zNewBrName)!=0 ){ | |
| 574 | + zBrChgMsg = mprintf(" Branch changed from %s to %s.", | |
| 575 | + zCurBrName, zNewBrName); | |
| 576 | + } | |
| 568 | 577 | if( nUpdate==0 ){ |
| 569 | 578 | show_common_info(tid, "checkout:", 1, 0); |
| 570 | - fossil_print("%-13s None. Already up-to-date\n", "changes:"); | |
| 579 | + fossil_print("%-13s None. Already up-to-date.%s\n", "changes:", zBrChgMsg); | |
| 571 | 580 | }else{ |
| 572 | 581 | fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid), |
| 573 | 582 | db_text("", "SELECT datetime(mtime) || ' UTC' FROM event " |
| 574 | 583 | " WHERE objid=%d", vid)); |
| 575 | 584 | show_common_info(tid, "updated-to:", 1, 0); |
| 576 | - fossil_print("%-13s %d file%s modified.\n", "changes:", | |
| 577 | - nUpdate, nUpdate>1 ? "s" : ""); | |
| 585 | + fossil_print("%-13s %d file%s modified.%s\n", "changes:", | |
| 586 | + nUpdate, nUpdate>1 ? "s" : "", zBrChgMsg); | |
| 578 | 587 | } |
| 579 | 588 | |
| 580 | 589 | /* Report on conflicts |
| 581 | 590 | */ |
| 582 | 591 | if( !dryRunFlag ){ |
| 583 | 592 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -132,10 +132,13 @@ | |
| 132 | int nUpdate = 0; /* Number of changes of any kind */ |
| 133 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 134 | int width; /* Width of printed comment lines */ |
| 135 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 136 | const char *zWidth; /* Width option string value */ |
| 137 | |
| 138 | if( !internalUpdate ){ |
| 139 | undo_capture_command_line(); |
| 140 | url_proxy_options(); |
| 141 | } |
| @@ -163,10 +166,11 @@ | |
| 163 | /* We should be done with options.. */ |
| 164 | verify_all_options(); |
| 165 | |
| 166 | db_must_be_within_tree(); |
| 167 | vid = db_lget_int("checkout", 0); |
| 168 | user_select(); |
| 169 | if( !dryRunFlag && !internalUpdate && !bNosync ){ |
| 170 | if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){ |
| 171 | fossil_fatal("update abandoned due to sync failure"); |
| 172 | } |
| @@ -563,20 +567,25 @@ | |
| 563 | free(zFullNewPath); |
| 564 | } |
| 565 | db_finalize(&q); |
| 566 | db_finalize(&mtimeXfer); |
| 567 | fossil_print("%.79c\n",'-'); |
| 568 | if( nUpdate==0 ){ |
| 569 | show_common_info(tid, "checkout:", 1, 0); |
| 570 | fossil_print("%-13s None. Already up-to-date\n", "changes:"); |
| 571 | }else{ |
| 572 | fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid), |
| 573 | db_text("", "SELECT datetime(mtime) || ' UTC' FROM event " |
| 574 | " WHERE objid=%d", vid)); |
| 575 | show_common_info(tid, "updated-to:", 1, 0); |
| 576 | fossil_print("%-13s %d file%s modified.\n", "changes:", |
| 577 | nUpdate, nUpdate>1 ? "s" : ""); |
| 578 | } |
| 579 | |
| 580 | /* Report on conflicts |
| 581 | */ |
| 582 | if( !dryRunFlag ){ |
| 583 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -132,10 +132,13 @@ | |
| 132 | int nUpdate = 0; /* Number of changes of any kind */ |
| 133 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 134 | int width; /* Width of printed comment lines */ |
| 135 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 136 | const char *zWidth; /* Width option string value */ |
| 137 | const char *zCurBrName; /* Current branch name */ |
| 138 | const char *zNewBrName; /* New branch name */ |
| 139 | const char *zBrChgMsg = ""; /* Message to display if branch changes */ |
| 140 | |
| 141 | if( !internalUpdate ){ |
| 142 | undo_capture_command_line(); |
| 143 | url_proxy_options(); |
| 144 | } |
| @@ -163,10 +166,11 @@ | |
| 166 | /* We should be done with options.. */ |
| 167 | verify_all_options(); |
| 168 | |
| 169 | db_must_be_within_tree(); |
| 170 | vid = db_lget_int("checkout", 0); |
| 171 | zCurBrName = branch_of_rid(vid); |
| 172 | user_select(); |
| 173 | if( !dryRunFlag && !internalUpdate && !bNosync ){ |
| 174 | if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){ |
| 175 | fossil_fatal("update abandoned due to sync failure"); |
| 176 | } |
| @@ -563,20 +567,25 @@ | |
| 567 | free(zFullNewPath); |
| 568 | } |
| 569 | db_finalize(&q); |
| 570 | db_finalize(&mtimeXfer); |
| 571 | fossil_print("%.79c\n",'-'); |
| 572 | zNewBrName = branch_of_rid(tid); |
| 573 | if( fossil_strcmp(zCurBrName, zNewBrName)!=0 ){ |
| 574 | zBrChgMsg = mprintf(" Branch changed from %s to %s.", |
| 575 | zCurBrName, zNewBrName); |
| 576 | } |
| 577 | if( nUpdate==0 ){ |
| 578 | show_common_info(tid, "checkout:", 1, 0); |
| 579 | fossil_print("%-13s None. Already up-to-date.%s\n", "changes:", zBrChgMsg); |
| 580 | }else{ |
| 581 | fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid), |
| 582 | db_text("", "SELECT datetime(mtime) || ' UTC' FROM event " |
| 583 | " WHERE objid=%d", vid)); |
| 584 | show_common_info(tid, "updated-to:", 1, 0); |
| 585 | fossil_print("%-13s %d file%s modified.%s\n", "changes:", |
| 586 | nUpdate, nUpdate>1 ? "s" : "", zBrChgMsg); |
| 587 | } |
| 588 | |
| 589 | /* Report on conflicts |
| 590 | */ |
| 591 | if( !dryRunFlag ){ |
| 592 |