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.

andybradford 2024-11-24 03:38 trunk
Commit bb9150c403e78db3ac7665188ce4d8886180bc8accb43ca88e65613a82d7b095
1 file changed +12 -3
+12 -3
--- src/update.c
+++ src/update.c
@@ -132,10 +132,13 @@
132132
int nUpdate = 0; /* Number of changes of any kind */
133133
int bNosync = 0; /* --nosync. Omit the auto-sync */
134134
int width; /* Width of printed comment lines */
135135
Stmt mtimeXfer; /* Statement to transfer mtimes */
136136
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 */
137140
138141
if( !internalUpdate ){
139142
undo_capture_command_line();
140143
url_proxy_options();
141144
}
@@ -163,10 +166,11 @@
163166
/* We should be done with options.. */
164167
verify_all_options();
165168
166169
db_must_be_within_tree();
167170
vid = db_lget_int("checkout", 0);
171
+ zCurBrName = branch_of_rid(vid);
168172
user_select();
169173
if( !dryRunFlag && !internalUpdate && !bNosync ){
170174
if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, 1, "update") ){
171175
fossil_fatal("update abandoned due to sync failure");
172176
}
@@ -563,20 +567,25 @@
563567
free(zFullNewPath);
564568
}
565569
db_finalize(&q);
566570
db_finalize(&mtimeXfer);
567571
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
+ }
568577
if( nUpdate==0 ){
569578
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);
571580
}else{
572581
fossil_print("%-13s %.40s %s\n", "updated-from:", rid_to_uuid(vid),
573582
db_text("", "SELECT datetime(mtime) || ' UTC' FROM event "
574583
" WHERE objid=%d", vid));
575584
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);
578587
}
579588
580589
/* Report on conflicts
581590
*/
582591
if( !dryRunFlag ){
583592
--- 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

Keyboard Shortcuts

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