Fossil SCM

Add some change statuses missing from /json/status, as reported in [forum:1e835e6a79|forum post 1e835e6a79]. Update the vfile.chnged docs to reflect values added since they were last updated.

stephan 2025-11-24 16:53 trunk
Commit 6112d901069b73f3d8c3f260693272a733ed66a7e946c9cc19d832e7269c2cf6
2 files changed +21 -15 +3 -1
+21 -15
--- src/json_status.c
+++ src/json_status.c
@@ -95,11 +95,12 @@
9595
aFiles = cson_new_array();
9696
cson_object_set( oPay, "files", cson_array_value( aFiles ) );
9797
9898
db_prepare(&q,
9999
"SELECT pathname, deleted, chnged, rid, "
100
- " coalesce(origname!=pathname,0), origname"
100
+ " coalesce(origname!=pathname,0) AS renamed,"
101
+ " origname"
101102
" FROM vfile "
102103
" WHERE is_selected(id)"
103104
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
104105
);
105106
while( db_step(&q)==SQLITE_ROW ){
@@ -108,11 +109,11 @@
108109
int isDeleted = db_column_int(&q, 1);
109110
int isChnged = db_column_int(&q,2);
110111
int isNew = db_column_int(&q,3)==0;
111112
int isRenamed = db_column_int(&q,4);
112113
cson_object * oFile;
113
- char const * zStatus = "???";
114
+ char const * zStatus = "unmodified";
114115
char * zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
115116
if( isDeleted ){
116117
zStatus = "deleted";
117118
}else if( isNew ){
118119
zStatus = "new" /* maintenance reminder: MUST come
@@ -123,23 +124,28 @@
123124
++nErr;
124125
}else{
125126
zStatus = "missing";
126127
++nErr;
127128
}
128
- }else if( 2==isChnged ){
129
- zStatus = "updatedByMerge";
130
- }else if( 3==isChnged ){
131
- zStatus = "addedByMerge";
132
- }else if( 4==isChnged ){
133
- zStatus = "updatedByIntegrate";
134
- }else if( 5==isChnged ){
135
- zStatus = "addedByIntegrate";
136
- }else if( 1==isChnged ){
137
- if( file_contains_merge_marker(zFullName) ){
138
- zStatus = "conflict";
139
- }else{
140
- zStatus = "edited";
129
+ }else if( isChnged ){
130
+ switch( isChnged ){
131
+ /* These numbers from from checkin.c: status_report() */
132
+ case 1:
133
+ if( file_contains_merge_marker(zFullName) ){
134
+ zStatus = "conflict";
135
+ }else{
136
+ zStatus = "edited";
137
+ }
138
+ break;
139
+ case 2: zStatus = "updatedByMerge"; break;
140
+ case 3: zStatus = "addedByMerge"; break;
141
+ case 4: zStatus = "updatedByIntegrate"; break;
142
+ case 5: zStatus = "addedByIntegrate"; break;
143
+ case 6: zStatus = "+exec"; break;
144
+ case 7: zStatus = "+symlink"; break;
145
+ case 8: zStatus = "-exec"; break;
146
+ case 9: zStatus = "unlink"; break;
141147
}
142148
}
143149
oFile = cson_new_object();
144150
cson_array_append( aFiles, cson_object_value(oFile) );
145151
if( isRenamed ){
146152
--- src/json_status.c
+++ src/json_status.c
@@ -95,11 +95,12 @@
95 aFiles = cson_new_array();
96 cson_object_set( oPay, "files", cson_array_value( aFiles ) );
97
98 db_prepare(&q,
99 "SELECT pathname, deleted, chnged, rid, "
100 " coalesce(origname!=pathname,0), origname"
 
101 " FROM vfile "
102 " WHERE is_selected(id)"
103 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
104 );
105 while( db_step(&q)==SQLITE_ROW ){
@@ -108,11 +109,11 @@
108 int isDeleted = db_column_int(&q, 1);
109 int isChnged = db_column_int(&q,2);
110 int isNew = db_column_int(&q,3)==0;
111 int isRenamed = db_column_int(&q,4);
112 cson_object * oFile;
113 char const * zStatus = "???";
114 char * zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
115 if( isDeleted ){
116 zStatus = "deleted";
117 }else if( isNew ){
118 zStatus = "new" /* maintenance reminder: MUST come
@@ -123,23 +124,28 @@
123 ++nErr;
124 }else{
125 zStatus = "missing";
126 ++nErr;
127 }
128 }else if( 2==isChnged ){
129 zStatus = "updatedByMerge";
130 }else if( 3==isChnged ){
131 zStatus = "addedByMerge";
132 }else if( 4==isChnged ){
133 zStatus = "updatedByIntegrate";
134 }else if( 5==isChnged ){
135 zStatus = "addedByIntegrate";
136 }else if( 1==isChnged ){
137 if( file_contains_merge_marker(zFullName) ){
138 zStatus = "conflict";
139 }else{
140 zStatus = "edited";
 
 
 
 
 
141 }
142 }
143 oFile = cson_new_object();
144 cson_array_append( aFiles, cson_object_value(oFile) );
145 if( isRenamed ){
146
--- src/json_status.c
+++ src/json_status.c
@@ -95,11 +95,12 @@
95 aFiles = cson_new_array();
96 cson_object_set( oPay, "files", cson_array_value( aFiles ) );
97
98 db_prepare(&q,
99 "SELECT pathname, deleted, chnged, rid, "
100 " coalesce(origname!=pathname,0) AS renamed,"
101 " origname"
102 " FROM vfile "
103 " WHERE is_selected(id)"
104 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
105 );
106 while( db_step(&q)==SQLITE_ROW ){
@@ -108,11 +109,11 @@
109 int isDeleted = db_column_int(&q, 1);
110 int isChnged = db_column_int(&q,2);
111 int isNew = db_column_int(&q,3)==0;
112 int isRenamed = db_column_int(&q,4);
113 cson_object * oFile;
114 char const * zStatus = "unmodified";
115 char * zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
116 if( isDeleted ){
117 zStatus = "deleted";
118 }else if( isNew ){
119 zStatus = "new" /* maintenance reminder: MUST come
@@ -123,23 +124,28 @@
124 ++nErr;
125 }else{
126 zStatus = "missing";
127 ++nErr;
128 }
129 }else if( isChnged ){
130 switch( isChnged ){
131 /* These numbers from from checkin.c: status_report() */
132 case 1:
133 if( file_contains_merge_marker(zFullName) ){
134 zStatus = "conflict";
135 }else{
136 zStatus = "edited";
137 }
138 break;
139 case 2: zStatus = "updatedByMerge"; break;
140 case 3: zStatus = "addedByMerge"; break;
141 case 4: zStatus = "updatedByIntegrate"; break;
142 case 5: zStatus = "addedByIntegrate"; break;
143 case 6: zStatus = "+exec"; break;
144 case 7: zStatus = "+symlink"; break;
145 case 8: zStatus = "-exec"; break;
146 case 9: zStatus = "unlink"; break;
147 }
148 }
149 oFile = cson_new_object();
150 cson_array_append( aFiles, cson_object_value(oFile) );
151 if( isRenamed ){
152
+3 -1
--- src/schema.c
+++ src/schema.c
@@ -560,11 +560,13 @@
560560
@ -- 4,5 Same as 2,3 except merge using --integrate
561561
@ --
562562
@ CREATE TABLE vfile(
563563
@ id INTEGER PRIMARY KEY, -- ID of the checked-out file
564564
@ vid INTEGER REFERENCES blob, -- The check-in this file is part of.
565
-@ chnged INT DEFAULT 0, -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng 5:i-add
565
+@ chnged INT DEFAULT 0,
566
+@ -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng
567
+@ -- 5:i-add 6:+exec 7:+symlink 8:-exec 9:unlink
566568
@ deleted BOOLEAN DEFAULT 0, -- True if deleted
567569
@ isexe BOOLEAN, -- True if file should be executable
568570
@ islink BOOLEAN, -- True if file should be symlink
569571
@ rid INTEGER, -- Originally from this repository record
570572
@ mrid INTEGER, -- Based on this record due to a merge
571573
--- src/schema.c
+++ src/schema.c
@@ -560,11 +560,13 @@
560 @ -- 4,5 Same as 2,3 except merge using --integrate
561 @ --
562 @ CREATE TABLE vfile(
563 @ id INTEGER PRIMARY KEY, -- ID of the checked-out file
564 @ vid INTEGER REFERENCES blob, -- The check-in this file is part of.
565 @ chnged INT DEFAULT 0, -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng 5:i-add
 
 
566 @ deleted BOOLEAN DEFAULT 0, -- True if deleted
567 @ isexe BOOLEAN, -- True if file should be executable
568 @ islink BOOLEAN, -- True if file should be symlink
569 @ rid INTEGER, -- Originally from this repository record
570 @ mrid INTEGER, -- Based on this record due to a merge
571
--- src/schema.c
+++ src/schema.c
@@ -560,11 +560,13 @@
560 @ -- 4,5 Same as 2,3 except merge using --integrate
561 @ --
562 @ CREATE TABLE vfile(
563 @ id INTEGER PRIMARY KEY, -- ID of the checked-out file
564 @ vid INTEGER REFERENCES blob, -- The check-in this file is part of.
565 @ chnged INT DEFAULT 0,
566 @ -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng
567 @ -- 5:i-add 6:+exec 7:+symlink 8:-exec 9:unlink
568 @ deleted BOOLEAN DEFAULT 0, -- True if deleted
569 @ isexe BOOLEAN, -- True if file should be executable
570 @ islink BOOLEAN, -- True if file should be symlink
571 @ rid INTEGER, -- Originally from this repository record
572 @ mrid INTEGER, -- Based on this record due to a merge
573

Keyboard Shortcuts

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