Fossil SCM

Wiki test fixes.

drh 2019-09-03 20:36 trunk merge
Commit b40f1ac135038a0b410d21a882aa1dd78fd831bd201fc38561b4c7cc5296c6ae
+7 -2
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192192
int i;
193193
int startOfBranch = 0;
194194
const char *zXTag; /* zTag with optional [...] removed */
195195
int nXTag; /* Size of zXTag */
196196
const char *zDate; /* Expanded date-time string */
197
+ const char *zTagPrefix = "sym";
197198
198199
if( zType==0 || zType[0]==0 ){
199200
zType = "*";
200201
}else if( zType[0]=='b' ){
201202
zType = "ci";
@@ -354,20 +355,24 @@
354355
}
355356
db_finalize(&q);
356357
if( rid ) return rid;
357358
}
358359
360
+ if( zType[0]=='w' ){
361
+ zTagPrefix = "wiki";
362
+ }
359363
/* Symbolic name */
360364
rid = db_int(0,
361365
"SELECT event.objid, max(event.mtime)"
362366
" FROM tag, tagxref, event"
363
- " WHERE tag.tagname='sym-%q' "
367
+ " WHERE tag.tagname='%q-%q' "
364368
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
365369
" AND event.objid=tagxref.rid "
366370
" AND event.type GLOB '%q'",
367
- zTag, zType
371
+ zTagPrefix, zTag, zType
368372
);
373
+
369374
if( rid>0 ){
370375
if( startOfBranch ) rid = start_of_branch(rid,1);
371376
return rid;
372377
}
373378
374379
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192 int i;
193 int startOfBranch = 0;
194 const char *zXTag; /* zTag with optional [...] removed */
195 int nXTag; /* Size of zXTag */
196 const char *zDate; /* Expanded date-time string */
 
197
198 if( zType==0 || zType[0]==0 ){
199 zType = "*";
200 }else if( zType[0]=='b' ){
201 zType = "ci";
@@ -354,20 +355,24 @@
354 }
355 db_finalize(&q);
356 if( rid ) return rid;
357 }
358
 
 
 
359 /* Symbolic name */
360 rid = db_int(0,
361 "SELECT event.objid, max(event.mtime)"
362 " FROM tag, tagxref, event"
363 " WHERE tag.tagname='sym-%q' "
364 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
365 " AND event.objid=tagxref.rid "
366 " AND event.type GLOB '%q'",
367 zTag, zType
368 );
 
369 if( rid>0 ){
370 if( startOfBranch ) rid = start_of_branch(rid,1);
371 return rid;
372 }
373
374
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192 int i;
193 int startOfBranch = 0;
194 const char *zXTag; /* zTag with optional [...] removed */
195 int nXTag; /* Size of zXTag */
196 const char *zDate; /* Expanded date-time string */
197 const char *zTagPrefix = "sym";
198
199 if( zType==0 || zType[0]==0 ){
200 zType = "*";
201 }else if( zType[0]=='b' ){
202 zType = "ci";
@@ -354,20 +355,24 @@
355 }
356 db_finalize(&q);
357 if( rid ) return rid;
358 }
359
360 if( zType[0]=='w' ){
361 zTagPrefix = "wiki";
362 }
363 /* Symbolic name */
364 rid = db_int(0,
365 "SELECT event.objid, max(event.mtime)"
366 " FROM tag, tagxref, event"
367 " WHERE tag.tagname='%q-%q' "
368 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
369 " AND event.objid=tagxref.rid "
370 " AND event.type GLOB '%q'",
371 zTagPrefix, zTag, zType
372 );
373
374 if( rid>0 ){
375 if( startOfBranch ) rid = start_of_branch(rid,1);
376 return rid;
377 }
378
379
+7 -2
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192192
int i;
193193
int startOfBranch = 0;
194194
const char *zXTag; /* zTag with optional [...] removed */
195195
int nXTag; /* Size of zXTag */
196196
const char *zDate; /* Expanded date-time string */
197
+ const char *zTagPrefix = "sym";
197198
198199
if( zType==0 || zType[0]==0 ){
199200
zType = "*";
200201
}else if( zType[0]=='b' ){
201202
zType = "ci";
@@ -354,20 +355,24 @@
354355
}
355356
db_finalize(&q);
356357
if( rid ) return rid;
357358
}
358359
360
+ if( zType[0]=='w' ){
361
+ zTagPrefix = "wiki";
362
+ }
359363
/* Symbolic name */
360364
rid = db_int(0,
361365
"SELECT event.objid, max(event.mtime)"
362366
" FROM tag, tagxref, event"
363
- " WHERE tag.tagname='sym-%q' "
367
+ " WHERE tag.tagname='%q-%q' "
364368
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
365369
" AND event.objid=tagxref.rid "
366370
" AND event.type GLOB '%q'",
367
- zTag, zType
371
+ zTagPrefix, zTag, zType
368372
);
373
+
369374
if( rid>0 ){
370375
if( startOfBranch ) rid = start_of_branch(rid,1);
371376
return rid;
372377
}
373378
374379
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192 int i;
193 int startOfBranch = 0;
194 const char *zXTag; /* zTag with optional [...] removed */
195 int nXTag; /* Size of zXTag */
196 const char *zDate; /* Expanded date-time string */
 
197
198 if( zType==0 || zType[0]==0 ){
199 zType = "*";
200 }else if( zType[0]=='b' ){
201 zType = "ci";
@@ -354,20 +355,24 @@
354 }
355 db_finalize(&q);
356 if( rid ) return rid;
357 }
358
 
 
 
359 /* Symbolic name */
360 rid = db_int(0,
361 "SELECT event.objid, max(event.mtime)"
362 " FROM tag, tagxref, event"
363 " WHERE tag.tagname='sym-%q' "
364 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
365 " AND event.objid=tagxref.rid "
366 " AND event.type GLOB '%q'",
367 zTag, zType
368 );
 
369 if( rid>0 ){
370 if( startOfBranch ) rid = start_of_branch(rid,1);
371 return rid;
372 }
373
374
--- src/name.c
+++ src/name.c
@@ -192,10 +192,11 @@
192 int i;
193 int startOfBranch = 0;
194 const char *zXTag; /* zTag with optional [...] removed */
195 int nXTag; /* Size of zXTag */
196 const char *zDate; /* Expanded date-time string */
197 const char *zTagPrefix = "sym";
198
199 if( zType==0 || zType[0]==0 ){
200 zType = "*";
201 }else if( zType[0]=='b' ){
202 zType = "ci";
@@ -354,20 +355,24 @@
355 }
356 db_finalize(&q);
357 if( rid ) return rid;
358 }
359
360 if( zType[0]=='w' ){
361 zTagPrefix = "wiki";
362 }
363 /* Symbolic name */
364 rid = db_int(0,
365 "SELECT event.objid, max(event.mtime)"
366 " FROM tag, tagxref, event"
367 " WHERE tag.tagname='%q-%q' "
368 " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
369 " AND event.objid=tagxref.rid "
370 " AND event.type GLOB '%q'",
371 zTagPrefix, zTag, zType
372 );
373
374 if( rid>0 ){
375 if( startOfBranch ) rid = start_of_branch(rid,1);
376 return rid;
377 }
378
379
--- test/settings.test
+++ test/settings.test
@@ -39,11 +39,11 @@
3939
#
4040
proc extract_setting_names { data } {
4141
set names [list]
4242
4343
foreach {dummy name} [regexp \
44
- -all -line -inline -- {^([a-z][a-z0-9\-]*) } $data] {
44
+ -all -line -inline -- {^([a-z][a-z0-9\-]*) ?.*$} $data] {
4545
lappend names $name
4646
}
4747
4848
return $names
4949
}
5050
--- test/settings.test
+++ test/settings.test
@@ -39,11 +39,11 @@
39 #
40 proc extract_setting_names { data } {
41 set names [list]
42
43 foreach {dummy name} [regexp \
44 -all -line -inline -- {^([a-z][a-z0-9\-]*) } $data] {
45 lappend names $name
46 }
47
48 return $names
49 }
50
--- test/settings.test
+++ test/settings.test
@@ -39,11 +39,11 @@
39 #
40 proc extract_setting_names { data } {
41 set names [list]
42
43 foreach {dummy name} [regexp \
44 -all -line -inline -- {^([a-z][a-z0-9\-]*) ?.*$} $data] {
45 lappend names $name
46 }
47
48 return $names
49 }
50
--- test/tester.tcl
+++ test/tester.tcl
@@ -272,22 +272,32 @@
272272
auto-captcha \
273273
auto-hyperlink \
274274
auto-shun \
275275
autosync \
276276
autosync-tries \
277
+ backoffice-disable \
278
+ backoffice-logfile \
279
+ backoffice-nodelay \
277280
binary-glob \
278281
case-sensitive \
279282
clean-glob \
280283
clearsign \
284
+ comment-format \
281285
crlf-glob \
282286
crnl-glob \
283287
default-perms \
284288
diff-binary \
285289
diff-command \
286290
dont-push \
287291
dotfiles \
288292
editor \
293
+ email-self \
294
+ email-send-command \
295
+ email-send-db \
296
+ email-send-dir \
297
+ email-send-method \
298
+ email-send-relayhost \
289299
empty-dirs \
290300
encoding-glob \
291301
exec-rel-paths \
292302
gdiff-command \
293303
gmerge-command \
@@ -308,10 +318,11 @@
308318
repo-cksum \
309319
self-register \
310320
ssh-command \
311321
ssl-ca-location \
312322
ssl-identity \
323
+ tclsh \
313324
th1-setup \
314325
th1-uri-regexp \
315326
uv-sync \
316327
web-browser]
317328
318329
--- test/tester.tcl
+++ test/tester.tcl
@@ -272,22 +272,32 @@
272 auto-captcha \
273 auto-hyperlink \
274 auto-shun \
275 autosync \
276 autosync-tries \
 
 
 
277 binary-glob \
278 case-sensitive \
279 clean-glob \
280 clearsign \
 
281 crlf-glob \
282 crnl-glob \
283 default-perms \
284 diff-binary \
285 diff-command \
286 dont-push \
287 dotfiles \
288 editor \
 
 
 
 
 
 
289 empty-dirs \
290 encoding-glob \
291 exec-rel-paths \
292 gdiff-command \
293 gmerge-command \
@@ -308,10 +318,11 @@
308 repo-cksum \
309 self-register \
310 ssh-command \
311 ssl-ca-location \
312 ssl-identity \
 
313 th1-setup \
314 th1-uri-regexp \
315 uv-sync \
316 web-browser]
317
318
--- test/tester.tcl
+++ test/tester.tcl
@@ -272,22 +272,32 @@
272 auto-captcha \
273 auto-hyperlink \
274 auto-shun \
275 autosync \
276 autosync-tries \
277 backoffice-disable \
278 backoffice-logfile \
279 backoffice-nodelay \
280 binary-glob \
281 case-sensitive \
282 clean-glob \
283 clearsign \
284 comment-format \
285 crlf-glob \
286 crnl-glob \
287 default-perms \
288 diff-binary \
289 diff-command \
290 dont-push \
291 dotfiles \
292 editor \
293 email-self \
294 email-send-command \
295 email-send-db \
296 email-send-dir \
297 email-send-method \
298 email-send-relayhost \
299 empty-dirs \
300 encoding-glob \
301 exec-rel-paths \
302 gdiff-command \
303 gmerge-command \
@@ -308,10 +318,11 @@
318 repo-cksum \
319 self-register \
320 ssh-command \
321 ssl-ca-location \
322 ssl-identity \
323 tclsh \
324 th1-setup \
325 th1-uri-regexp \
326 uv-sync \
327 web-browser]
328
329
+10 -10
--- test/wiki.test
+++ test/wiki.test
@@ -45,25 +45,25 @@
4545
# Note: Makes fossil calls, so $CODE and $RESULT will be corrupted
4646
proc get_mime_type {name} {
4747
global CODE RESULT
4848
fossil http << "GET /wiki?name=$name"
4949
if {$CODE != 0} {
50
- return error: /wiki?name=$name $CODE $RESULT"
50
+ return "error: /wiki?name=$name $CODE $RESULT"
51
+ }
52
+ fossil whatis --type w $name
53
+ if {$CODE != 0} {
54
+ return "error: fossil whatis --type w $name $CODE $RESULT"
5155
}
52
- set CODE [regexp {href="/info/([0-9a-f]+)"} $RESULT match info]
56
+ set CODE [regexp -line {^artifact:\s*([0-9a-f]+)$} $RESULT match info]
5357
if {$CODE == 0} {
54
- return "error: No info link found for wiki page $name"
58
+ return "error: whatis returned no info for wiki page $name"
5559
}
56
- fossil http << "GET /artifact/$info"
60
+ fossil artifact $info
5761
if {$CODE != 0} {
58
- return "error: /artifact/$info $CODE $RESULT"
62
+ return "error: fossil artifact $info $CODE $RESULT"
5963
}
60
- set CODE [regexp {<pre>(.*)</pre>} $RESULT match pre]
61
- if {$CODE == 0} {
62
- return "error: No pre block in /artifact/$info"
63
- }
64
- set CODE [regexp -line {^N (.*)$} $pre match mimetype]
64
+ set CODE [regexp -line {^N (.*)$} $RESULT match mimetype]
6565
if {$CODE == 0} {
6666
return "text/x-fossil-wiki"
6767
}
6868
return $mimetype
6969
}
7070
--- test/wiki.test
+++ test/wiki.test
@@ -45,25 +45,25 @@
45 # Note: Makes fossil calls, so $CODE and $RESULT will be corrupted
46 proc get_mime_type {name} {
47 global CODE RESULT
48 fossil http << "GET /wiki?name=$name"
49 if {$CODE != 0} {
50 return error: /wiki?name=$name $CODE $RESULT"
 
 
 
 
51 }
52 set CODE [regexp {href="/info/([0-9a-f]+)"} $RESULT match info]
53 if {$CODE == 0} {
54 return "error: No info link found for wiki page $name"
55 }
56 fossil http << "GET /artifact/$info"
57 if {$CODE != 0} {
58 return "error: /artifact/$info $CODE $RESULT"
59 }
60 set CODE [regexp {<pre>(.*)</pre>} $RESULT match pre]
61 if {$CODE == 0} {
62 return "error: No pre block in /artifact/$info"
63 }
64 set CODE [regexp -line {^N (.*)$} $pre match mimetype]
65 if {$CODE == 0} {
66 return "text/x-fossil-wiki"
67 }
68 return $mimetype
69 }
70
--- test/wiki.test
+++ test/wiki.test
@@ -45,25 +45,25 @@
45 # Note: Makes fossil calls, so $CODE and $RESULT will be corrupted
46 proc get_mime_type {name} {
47 global CODE RESULT
48 fossil http << "GET /wiki?name=$name"
49 if {$CODE != 0} {
50 return "error: /wiki?name=$name $CODE $RESULT"
51 }
52 fossil whatis --type w $name
53 if {$CODE != 0} {
54 return "error: fossil whatis --type w $name $CODE $RESULT"
55 }
56 set CODE [regexp -line {^artifact:\s*([0-9a-f]+)$} $RESULT match info]
57 if {$CODE == 0} {
58 return "error: whatis returned no info for wiki page $name"
59 }
60 fossil artifact $info
61 if {$CODE != 0} {
62 return "error: fossil artifact $info $CODE $RESULT"
63 }
64 set CODE [regexp -line {^N (.*)$} $RESULT match mimetype]
 
 
 
 
65 if {$CODE == 0} {
66 return "text/x-fossil-wiki"
67 }
68 return $mimetype
69 }
70

Keyboard Shortcuts

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