Fossil SCM

Let users review and validate artifacts before shunning. Helpful in catching abbreviated hashes.

preben 2024-01-04 09:37 trunk merge
Commit 5e19daf9803d89e76bf54e677a028b62d870e8c152f5bb698b6cffbd9bff857c
1 file changed +61 -1
+61 -1
--- src/shun.c
+++ src/shun.c
@@ -47,10 +47,11 @@
4747
int cnt = 0;
4848
const char *zUuid = P("uuid");
4949
const char *zShun = P("shun");
5050
const char *zAccept = P("accept");
5151
const char *zRcvid = P("rcvid");
52
+ int reviewList = P("review")!=0;
5253
int nRcvid = 0;
5354
int numRows = 3;
5455
char *zCanonical = 0;
5556
5657
login_check_credentials();
@@ -85,11 +86,11 @@
8586
}
8687
zCanonical[j+1] = zCanonical[j] = 0;
8788
p = zCanonical;
8889
while( *p ){
8990
int nUuid = strlen(p);
90
- if( !hname_validate(p, nUuid) ){
91
+ if( !(reviewList || hname_validate(p, nUuid)) ){
9192
@ <p class="generalError">Error: Bad artifact IDs.</p>
9293
fossil_free(zCanonical);
9394
zCanonical = 0;
9495
break;
9596
}else{
@@ -155,10 +156,63 @@
155156
}
156157
@ have been shunned. They will no longer be pushed.
157158
@ They will be removed from the repository the next time the repository
158159
@ is rebuilt using the <b>fossil rebuild</b> command-line</p>
159160
}
161
+ if( zUuid && reviewList ){
162
+ const char *p;
163
+ int nTotal = 0;
164
+ int nOk = 0;
165
+ @ <table class="shun-review"><tbody><tr><td>
166
+ for( p = zUuid ; *p ; p += strlen(p)+1 ){
167
+ int rid = symbolic_name_to_rid(p, 0);
168
+ nTotal++;
169
+ if( rid < 0 ){
170
+ @ Ambiguous<br>
171
+ }else if( rid == 0 ){
172
+ if( !hname_validate(p, strlen(p)) ){
173
+ @ Bad artifact<br>
174
+ }else if(db_int(0, "SELECT 1 FROM shun WHERE uuid=%Q", p)){
175
+ @ Already shunned<br>
176
+ }else{
177
+ @ Unknown<br>
178
+ }
179
+ }else{
180
+ char *zCmpUuid = db_text(0,
181
+ "SELECT uuid"
182
+ " FROM blob, rcvfrom"
183
+ " WHERE rid=%d"
184
+ " AND rcvfrom.rcvid=blob.rcvid",
185
+ rid);
186
+ if( fossil_strcmp(p, zCmpUuid)==0 ){
187
+ nOk++;
188
+ @ OK</br>
189
+ }else{
190
+ @ Abbreviated<br>
191
+ }
192
+ }
193
+ }
194
+ @ </td><td>
195
+ for( p = zUuid ; *p ; p += strlen(p)+1 ){
196
+ int rid = symbolic_name_to_rid(p, 0);
197
+ if( rid > 0 ){
198
+ @ <a href="%R/artifact/%s(p)">%s(p)</a><br>
199
+ }else{
200
+ @ %s(p)<br>
201
+ }
202
+ }
203
+ @ </td></tr></tbody></table>
204
+ @ <p class="shunned">
205
+ if( nOk < nTotal){
206
+ @ <b>Warning:</b> Not all artifacts
207
+ }else if( nTotal==1 ){
208
+ @ The artifact is present and
209
+ }else{
210
+ @ All %i(nOk) artifacts are present and
211
+ }
212
+ @ can be shunned with its hash above.</p>
213
+ }
160214
if( zRcvid ){
161215
nRcvid = atoi(zRcvid);
162216
numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d",
163217
nRcvid);
164218
}
@@ -196,13 +250,19 @@
196250
while( db_step(&q)==SQLITE_ROW ){
197251
@ %s(db_column_text(&q, 0))
198252
}
199253
db_finalize(&q);
200254
}
255
+ }else if( zUuid && reviewList ){
256
+ const char *p;
257
+ for( p = zUuid ; *p ; p += strlen(p)+1 ){
258
+ @ %s(p)
259
+ }
201260
}
202261
@ </textarea>
203262
@ <input type="submit" name="add" value="Shun">
263
+ @ <input type="submit" name="review" value="Review">
204264
@ </div></form>
205265
@ </blockquote>
206266
@
207267
@ <a name="delshun"></a>
208268
@ <p>Enter the UUIDs of previously shunned artifacts to cause them to be
209269
--- src/shun.c
+++ src/shun.c
@@ -47,10 +47,11 @@
47 int cnt = 0;
48 const char *zUuid = P("uuid");
49 const char *zShun = P("shun");
50 const char *zAccept = P("accept");
51 const char *zRcvid = P("rcvid");
 
52 int nRcvid = 0;
53 int numRows = 3;
54 char *zCanonical = 0;
55
56 login_check_credentials();
@@ -85,11 +86,11 @@
85 }
86 zCanonical[j+1] = zCanonical[j] = 0;
87 p = zCanonical;
88 while( *p ){
89 int nUuid = strlen(p);
90 if( !hname_validate(p, nUuid) ){
91 @ <p class="generalError">Error: Bad artifact IDs.</p>
92 fossil_free(zCanonical);
93 zCanonical = 0;
94 break;
95 }else{
@@ -155,10 +156,63 @@
155 }
156 @ have been shunned. They will no longer be pushed.
157 @ They will be removed from the repository the next time the repository
158 @ is rebuilt using the <b>fossil rebuild</b> command-line</p>
159 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160 if( zRcvid ){
161 nRcvid = atoi(zRcvid);
162 numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d",
163 nRcvid);
164 }
@@ -196,13 +250,19 @@
196 while( db_step(&q)==SQLITE_ROW ){
197 @ %s(db_column_text(&q, 0))
198 }
199 db_finalize(&q);
200 }
 
 
 
 
 
201 }
202 @ </textarea>
203 @ <input type="submit" name="add" value="Shun">
 
204 @ </div></form>
205 @ </blockquote>
206 @
207 @ <a name="delshun"></a>
208 @ <p>Enter the UUIDs of previously shunned artifacts to cause them to be
209
--- src/shun.c
+++ src/shun.c
@@ -47,10 +47,11 @@
47 int cnt = 0;
48 const char *zUuid = P("uuid");
49 const char *zShun = P("shun");
50 const char *zAccept = P("accept");
51 const char *zRcvid = P("rcvid");
52 int reviewList = P("review")!=0;
53 int nRcvid = 0;
54 int numRows = 3;
55 char *zCanonical = 0;
56
57 login_check_credentials();
@@ -85,11 +86,11 @@
86 }
87 zCanonical[j+1] = zCanonical[j] = 0;
88 p = zCanonical;
89 while( *p ){
90 int nUuid = strlen(p);
91 if( !(reviewList || hname_validate(p, nUuid)) ){
92 @ <p class="generalError">Error: Bad artifact IDs.</p>
93 fossil_free(zCanonical);
94 zCanonical = 0;
95 break;
96 }else{
@@ -155,10 +156,63 @@
156 }
157 @ have been shunned. They will no longer be pushed.
158 @ They will be removed from the repository the next time the repository
159 @ is rebuilt using the <b>fossil rebuild</b> command-line</p>
160 }
161 if( zUuid && reviewList ){
162 const char *p;
163 int nTotal = 0;
164 int nOk = 0;
165 @ <table class="shun-review"><tbody><tr><td>
166 for( p = zUuid ; *p ; p += strlen(p)+1 ){
167 int rid = symbolic_name_to_rid(p, 0);
168 nTotal++;
169 if( rid < 0 ){
170 @ Ambiguous<br>
171 }else if( rid == 0 ){
172 if( !hname_validate(p, strlen(p)) ){
173 @ Bad artifact<br>
174 }else if(db_int(0, "SELECT 1 FROM shun WHERE uuid=%Q", p)){
175 @ Already shunned<br>
176 }else{
177 @ Unknown<br>
178 }
179 }else{
180 char *zCmpUuid = db_text(0,
181 "SELECT uuid"
182 " FROM blob, rcvfrom"
183 " WHERE rid=%d"
184 " AND rcvfrom.rcvid=blob.rcvid",
185 rid);
186 if( fossil_strcmp(p, zCmpUuid)==0 ){
187 nOk++;
188 @ OK</br>
189 }else{
190 @ Abbreviated<br>
191 }
192 }
193 }
194 @ </td><td>
195 for( p = zUuid ; *p ; p += strlen(p)+1 ){
196 int rid = symbolic_name_to_rid(p, 0);
197 if( rid > 0 ){
198 @ <a href="%R/artifact/%s(p)">%s(p)</a><br>
199 }else{
200 @ %s(p)<br>
201 }
202 }
203 @ </td></tr></tbody></table>
204 @ <p class="shunned">
205 if( nOk < nTotal){
206 @ <b>Warning:</b> Not all artifacts
207 }else if( nTotal==1 ){
208 @ The artifact is present and
209 }else{
210 @ All %i(nOk) artifacts are present and
211 }
212 @ can be shunned with its hash above.</p>
213 }
214 if( zRcvid ){
215 nRcvid = atoi(zRcvid);
216 numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d",
217 nRcvid);
218 }
@@ -196,13 +250,19 @@
250 while( db_step(&q)==SQLITE_ROW ){
251 @ %s(db_column_text(&q, 0))
252 }
253 db_finalize(&q);
254 }
255 }else if( zUuid && reviewList ){
256 const char *p;
257 for( p = zUuid ; *p ; p += strlen(p)+1 ){
258 @ %s(p)
259 }
260 }
261 @ </textarea>
262 @ <input type="submit" name="add" value="Shun">
263 @ <input type="submit" name="review" value="Review">
264 @ </div></form>
265 @ </blockquote>
266 @
267 @ <a name="delshun"></a>
268 @ <p>Enter the UUIDs of previously shunned artifacts to cause them to be
269

Keyboard Shortcuts

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