Fossil SCM

Display "fork" status on "fossil info", "fossil status" and related commands as well.

jan.nijtmans 2015-04-10 16:35 UTC pending-review
Commit 11b7fa691499c0475cdde809337b67caacb0e5a8
2 files changed +10 -3 +4 -3
+10 -3
--- src/info.c
+++ src/info.c
@@ -48,12 +48,14 @@
4848
**
4949
** * The UUID
5050
** * The record ID
5151
** * mtime and ctime
5252
** * who signed it
53
+**
54
+** Returns 1 when a fork was found.
5355
*/
54
-void show_common_info(
56
+int show_common_info(
5557
int rid, /* The rid for the check-in to display info for */
5658
const char *zUuidName, /* Name of the UUID */
5759
int showComment, /* True to show the check-in comment */
5860
int showFamily /* True to show parents and children */
5961
){
@@ -60,10 +62,11 @@
6062
Stmt q;
6163
char *zComment = 0;
6264
char *zTags;
6365
char *zDate;
6466
char *zUuid;
67
+ int isFork = 0;
6568
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
6669
if( zUuid ){
6770
zDate = db_text(0,
6871
"SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
6972
rid
@@ -111,12 +114,15 @@
111114
}
112115
db_finalize(&q);
113116
}
114117
if( zUuid ){
115118
fossil_print("%-13s ", "leaf:");
116
- if(is_a_leaf(rid)){
117
- if(db_int(0, "SELECT 1 FROM tagxref AS tx"
119
+ if( is_a_leaf(rid) ){
120
+ if( fossil_find_nearest_fork(rid) ){
121
+ fossil_print("%s\n", "fork");
122
+ isFork = 1;
123
+ }else if(db_int(0, "SELECT 1 FROM tagxref AS tx"
118124
" WHERE tx.rid=%d"
119125
" AND tx.tagid=%d"
120126
" AND tx.tagtype>0",
121127
rid, TAG_CLOSED)){
122128
fossil_print("%s\n", "closed");
@@ -135,10 +141,11 @@
135141
if( zComment ){
136142
fossil_print("comment: ");
137143
comment_print(zComment, 0, 14, -1, g.comFmtFlags);
138144
free(zComment);
139145
}
146
+ return isFork;
140147
}
141148
142149
/*
143150
** Print information about the URLs used to access a repository and
144151
** checkouts in a repository.
145152
--- src/info.c
+++ src/info.c
@@ -48,12 +48,14 @@
48 **
49 ** * The UUID
50 ** * The record ID
51 ** * mtime and ctime
52 ** * who signed it
 
 
53 */
54 void show_common_info(
55 int rid, /* The rid for the check-in to display info for */
56 const char *zUuidName, /* Name of the UUID */
57 int showComment, /* True to show the check-in comment */
58 int showFamily /* True to show parents and children */
59 ){
@@ -60,10 +62,11 @@
60 Stmt q;
61 char *zComment = 0;
62 char *zTags;
63 char *zDate;
64 char *zUuid;
 
65 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
66 if( zUuid ){
67 zDate = db_text(0,
68 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
69 rid
@@ -111,12 +114,15 @@
111 }
112 db_finalize(&q);
113 }
114 if( zUuid ){
115 fossil_print("%-13s ", "leaf:");
116 if(is_a_leaf(rid)){
117 if(db_int(0, "SELECT 1 FROM tagxref AS tx"
 
 
 
118 " WHERE tx.rid=%d"
119 " AND tx.tagid=%d"
120 " AND tx.tagtype>0",
121 rid, TAG_CLOSED)){
122 fossil_print("%s\n", "closed");
@@ -135,10 +141,11 @@
135 if( zComment ){
136 fossil_print("comment: ");
137 comment_print(zComment, 0, 14, -1, g.comFmtFlags);
138 free(zComment);
139 }
 
140 }
141
142 /*
143 ** Print information about the URLs used to access a repository and
144 ** checkouts in a repository.
145
--- src/info.c
+++ src/info.c
@@ -48,12 +48,14 @@
48 **
49 ** * The UUID
50 ** * The record ID
51 ** * mtime and ctime
52 ** * who signed it
53 **
54 ** Returns 1 when a fork was found.
55 */
56 int show_common_info(
57 int rid, /* The rid for the check-in to display info for */
58 const char *zUuidName, /* Name of the UUID */
59 int showComment, /* True to show the check-in comment */
60 int showFamily /* True to show parents and children */
61 ){
@@ -60,10 +62,11 @@
62 Stmt q;
63 char *zComment = 0;
64 char *zTags;
65 char *zDate;
66 char *zUuid;
67 int isFork = 0;
68 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
69 if( zUuid ){
70 zDate = db_text(0,
71 "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d",
72 rid
@@ -111,12 +114,15 @@
114 }
115 db_finalize(&q);
116 }
117 if( zUuid ){
118 fossil_print("%-13s ", "leaf:");
119 if( is_a_leaf(rid) ){
120 if( fossil_find_nearest_fork(rid) ){
121 fossil_print("%s\n", "fork");
122 isFork = 1;
123 }else if(db_int(0, "SELECT 1 FROM tagxref AS tx"
124 " WHERE tx.rid=%d"
125 " AND tx.tagid=%d"
126 " AND tx.tagtype>0",
127 rid, TAG_CLOSED)){
128 fossil_print("%s\n", "closed");
@@ -135,10 +141,11 @@
141 if( zComment ){
142 fossil_print("comment: ");
143 comment_print(zComment, 0, 14, -1, g.comFmtFlags);
144 free(zComment);
145 }
146 return isFork;
147 }
148
149 /*
150 ** Print information about the URLs used to access a repository and
151 ** checkouts in a repository.
152
+4 -3
--- src/update.c
+++ src/update.c
@@ -121,10 +121,11 @@
121121
int nOverwrite = 0; /* Number of unmanaged files overwritten */
122122
int nUpdate = 0; /* Number of changes of any kind */
123123
int width; /* Width of printed comment lines */
124124
Stmt mtimeXfer; /* Statement to transfer mtimes */
125125
const char *zWidth; /* Width option string value */
126
+ int isFork;
126127
127128
if( !internalUpdate ){
128129
undo_capture_command_line();
129130
url_proxy_options();
130131
}
@@ -518,14 +519,14 @@
518519
}
519520
db_finalize(&q);
520521
db_finalize(&mtimeXfer);
521522
fossil_print("%.79c\n",'-');
522523
if( nUpdate==0 ){
523
- show_common_info(tid, "checkout:", 1, 0);
524
+ isFork = show_common_info(tid, "checkout:", 1, 0);
524525
fossil_print("%-13s None. Already up-to-date\n", "changes:");
525526
}else{
526
- show_common_info(tid, "updated-to:", 1, 0);
527
+ isFork = show_common_info(tid, "updated-to:", 1, 0);
527528
fossil_print("%-13s %d file%s modified.\n", "changes:",
528529
nUpdate, nUpdate>1 ? "s" : "");
529530
}
530531
531532
/* Report on conflicts
@@ -560,11 +561,11 @@
560561
nOverwrite);
561562
}
562563
if( nMerge ){
563564
fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
564565
}
565
- if( fossil_find_nearest_fork(tid) ){
566
+ if( isFork ){
566567
fossil_warning("WARNING: fork detected, please do a \"fossil merge\"");
567568
}
568569
}
569570
570571
/*
571572
--- src/update.c
+++ src/update.c
@@ -121,10 +121,11 @@
121 int nOverwrite = 0; /* Number of unmanaged files overwritten */
122 int nUpdate = 0; /* Number of changes of any kind */
123 int width; /* Width of printed comment lines */
124 Stmt mtimeXfer; /* Statement to transfer mtimes */
125 const char *zWidth; /* Width option string value */
 
126
127 if( !internalUpdate ){
128 undo_capture_command_line();
129 url_proxy_options();
130 }
@@ -518,14 +519,14 @@
518 }
519 db_finalize(&q);
520 db_finalize(&mtimeXfer);
521 fossil_print("%.79c\n",'-');
522 if( nUpdate==0 ){
523 show_common_info(tid, "checkout:", 1, 0);
524 fossil_print("%-13s None. Already up-to-date\n", "changes:");
525 }else{
526 show_common_info(tid, "updated-to:", 1, 0);
527 fossil_print("%-13s %d file%s modified.\n", "changes:",
528 nUpdate, nUpdate>1 ? "s" : "");
529 }
530
531 /* Report on conflicts
@@ -560,11 +561,11 @@
560 nOverwrite);
561 }
562 if( nMerge ){
563 fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
564 }
565 if( fossil_find_nearest_fork(tid) ){
566 fossil_warning("WARNING: fork detected, please do a \"fossil merge\"");
567 }
568 }
569
570 /*
571
--- src/update.c
+++ src/update.c
@@ -121,10 +121,11 @@
121 int nOverwrite = 0; /* Number of unmanaged files overwritten */
122 int nUpdate = 0; /* Number of changes of any kind */
123 int width; /* Width of printed comment lines */
124 Stmt mtimeXfer; /* Statement to transfer mtimes */
125 const char *zWidth; /* Width option string value */
126 int isFork;
127
128 if( !internalUpdate ){
129 undo_capture_command_line();
130 url_proxy_options();
131 }
@@ -518,14 +519,14 @@
519 }
520 db_finalize(&q);
521 db_finalize(&mtimeXfer);
522 fossil_print("%.79c\n",'-');
523 if( nUpdate==0 ){
524 isFork = show_common_info(tid, "checkout:", 1, 0);
525 fossil_print("%-13s None. Already up-to-date\n", "changes:");
526 }else{
527 isFork = show_common_info(tid, "updated-to:", 1, 0);
528 fossil_print("%-13s %d file%s modified.\n", "changes:",
529 nUpdate, nUpdate>1 ? "s" : "");
530 }
531
532 /* Report on conflicts
@@ -560,11 +561,11 @@
561 nOverwrite);
562 }
563 if( nMerge ){
564 fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
565 }
566 if( isFork ){
567 fossil_warning("WARNING: fork detected, please do a \"fossil merge\"");
568 }
569 }
570
571 /*
572

Keyboard Shortcuts

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