Fossil SCM

Merge updates from trunk.

mistachkin 2014-06-16 20:01 UTC autoadjust merge
Commit 3c9cca2bd8d012cca4f67b4d7d674ccc747f9897
+13 -13
--- src/db.c
+++ src/db.c
@@ -715,13 +715,10 @@
715715
*/
716716
LOCAL sqlite3 *db_open(const char *zDbName){
717717
int rc;
718718
sqlite3 *db;
719719
720
-#if defined(__CYGWIN__) && USE_SYSTEM_SQLITE+0!=1
721
- zDbName = fossil_utf8_to_filename(zDbName);
722
-#endif
723720
if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
724721
rc = sqlite3_open_v2(
725722
zDbName, &db,
726723
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
727724
g.zVfsName
@@ -795,15 +792,17 @@
795792
if( g.useAttach ){
796793
db_detach("configdb");
797794
g.useAttach = 0;
798795
g.zConfigDbName = 0;
799796
}else if( g.dbConfig ){
797
+ sqlite3_wal_checkpoint(g.dbConfig, 0);
800798
sqlite3_close(g.dbConfig);
801799
g.dbConfig = 0;
802800
g.zConfigDbType = 0;
803801
g.zConfigDbName = 0;
804802
}else if( g.db && fossil_strcmp(g.zMainDbType, "configdb")==0 ){
803
+ sqlite3_wal_checkpoint(g.db, 0);
805804
sqlite3_close(g.db);
806805
g.db = 0;
807806
g.zMainDbType = 0;
808807
g.zConfigDbName = 0;
809808
}
@@ -1231,22 +1230,23 @@
12311230
if( reportErrors ){
12321231
while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
12331232
fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
12341233
}
12351234
}
1235
+ db_close_config();
1236
+ if( g.db ){
1237
+ sqlite3_wal_checkpoint(g.db, 0);
1238
+ sqlite3_close(g.db);
1239
+ g.db = 0;
1240
+ g.zMainDbType = 0;
1241
+ }
12361242
g.repositoryOpen = 0;
12371243
g.localOpen = 0;
1238
- g.zConfigDbName = NULL;
1239
- sqlite3_wal_checkpoint(g.db, 0);
1240
- sqlite3_close(g.db);
1241
- g.db = 0;
1242
- g.zMainDbType = 0;
1243
- if( g.dbConfig ){
1244
- sqlite3_close(g.dbConfig);
1245
- g.dbConfig = 0;
1246
- g.zConfigDbType = 0;
1247
- }
1244
+ assert( g.dbConfig==0 );
1245
+ assert( g.useAttach==0 );
1246
+ assert( g.zConfigDbName==0 );
1247
+ assert( g.zConfigDbType==0 );
12481248
}
12491249
12501250
12511251
/*
12521252
** Create a new empty repository database with the given name.
12531253
--- src/db.c
+++ src/db.c
@@ -715,13 +715,10 @@
715 */
716 LOCAL sqlite3 *db_open(const char *zDbName){
717 int rc;
718 sqlite3 *db;
719
720 #if defined(__CYGWIN__) && USE_SYSTEM_SQLITE+0!=1
721 zDbName = fossil_utf8_to_filename(zDbName);
722 #endif
723 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
724 rc = sqlite3_open_v2(
725 zDbName, &db,
726 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
727 g.zVfsName
@@ -795,15 +792,17 @@
795 if( g.useAttach ){
796 db_detach("configdb");
797 g.useAttach = 0;
798 g.zConfigDbName = 0;
799 }else if( g.dbConfig ){
 
800 sqlite3_close(g.dbConfig);
801 g.dbConfig = 0;
802 g.zConfigDbType = 0;
803 g.zConfigDbName = 0;
804 }else if( g.db && fossil_strcmp(g.zMainDbType, "configdb")==0 ){
 
805 sqlite3_close(g.db);
806 g.db = 0;
807 g.zMainDbType = 0;
808 g.zConfigDbName = 0;
809 }
@@ -1231,22 +1230,23 @@
1231 if( reportErrors ){
1232 while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
1233 fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
1234 }
1235 }
 
 
 
 
 
 
 
1236 g.repositoryOpen = 0;
1237 g.localOpen = 0;
1238 g.zConfigDbName = NULL;
1239 sqlite3_wal_checkpoint(g.db, 0);
1240 sqlite3_close(g.db);
1241 g.db = 0;
1242 g.zMainDbType = 0;
1243 if( g.dbConfig ){
1244 sqlite3_close(g.dbConfig);
1245 g.dbConfig = 0;
1246 g.zConfigDbType = 0;
1247 }
1248 }
1249
1250
1251 /*
1252 ** Create a new empty repository database with the given name.
1253
--- src/db.c
+++ src/db.c
@@ -715,13 +715,10 @@
715 */
716 LOCAL sqlite3 *db_open(const char *zDbName){
717 int rc;
718 sqlite3 *db;
719
 
 
 
720 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
721 rc = sqlite3_open_v2(
722 zDbName, &db,
723 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
724 g.zVfsName
@@ -795,15 +792,17 @@
792 if( g.useAttach ){
793 db_detach("configdb");
794 g.useAttach = 0;
795 g.zConfigDbName = 0;
796 }else if( g.dbConfig ){
797 sqlite3_wal_checkpoint(g.dbConfig, 0);
798 sqlite3_close(g.dbConfig);
799 g.dbConfig = 0;
800 g.zConfigDbType = 0;
801 g.zConfigDbName = 0;
802 }else if( g.db && fossil_strcmp(g.zMainDbType, "configdb")==0 ){
803 sqlite3_wal_checkpoint(g.db, 0);
804 sqlite3_close(g.db);
805 g.db = 0;
806 g.zMainDbType = 0;
807 g.zConfigDbName = 0;
808 }
@@ -1231,22 +1230,23 @@
1230 if( reportErrors ){
1231 while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
1232 fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
1233 }
1234 }
1235 db_close_config();
1236 if( g.db ){
1237 sqlite3_wal_checkpoint(g.db, 0);
1238 sqlite3_close(g.db);
1239 g.db = 0;
1240 g.zMainDbType = 0;
1241 }
1242 g.repositoryOpen = 0;
1243 g.localOpen = 0;
1244 assert( g.dbConfig==0 );
1245 assert( g.useAttach==0 );
1246 assert( g.zConfigDbName==0 );
1247 assert( g.zConfigDbType==0 );
 
 
 
 
 
 
1248 }
1249
1250
1251 /*
1252 ** Create a new empty repository database with the given name.
1253
+29 -2
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
15601560
@ <blockquote><pre>
15611561
hexdump(&content);
15621562
@ </pre></blockquote>
15631563
style_footer();
15641564
}
1565
+
1566
+/*
1567
+** Attempt to lookup the specified checkin and file name into an rid.
1568
+*/
1569
+int artifact_from_ci_and_filename(
1570
+ const char *zCI,
1571
+ const char *zFilename
1572
+){
1573
+ int cirid;
1574
+ Manifest *pManifest;
1575
+ ManifestFile *pFile;
1576
+
1577
+ if( zCI==0 ) return 0;
1578
+ if( zFilename==0 ) return 0;
1579
+ cirid = name_to_rid(zCI);
1580
+ pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
1581
+ if( pManifest==0 ) return 0;
1582
+ manifest_file_rewind(pManifest);
1583
+ while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1584
+ if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1585
+ int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
1586
+ manifest_destroy(pManifest);
1587
+ return rid;
1588
+ }
1589
+ }
1590
+ return 0;
1591
+}
15651592
15661593
/*
15671594
** Look for "ci" and "filename" query parameters. If found, try to
15681595
** use them to extract the record ID of an artifact for the file.
15691596
*/
1570
-int artifact_from_ci_and_filename(void){
1597
+int artifact_from_ci_and_filename_www(void){
15711598
const char *zFilename;
15721599
const char *zCI;
15731600
int cirid;
15741601
Manifest *pManifest;
15751602
ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
16731700
int objType;
16741701
int asText;
16751702
const char *zUuid;
16761703
16771704
if( P("ci") && P("filename") ){
1678
- rid = artifact_from_ci_and_filename();
1705
+ rid = artifact_from_ci_and_filename_www();
16791706
}
16801707
if( rid==0 ){
16811708
rid = name_to_rid_www("name");
16821709
}
16831710
16841711
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
1560 @ <blockquote><pre>
1561 hexdump(&content);
1562 @ </pre></blockquote>
1563 style_footer();
1564 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1565
1566 /*
1567 ** Look for "ci" and "filename" query parameters. If found, try to
1568 ** use them to extract the record ID of an artifact for the file.
1569 */
1570 int artifact_from_ci_and_filename(void){
1571 const char *zFilename;
1572 const char *zCI;
1573 int cirid;
1574 Manifest *pManifest;
1575 ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
1673 int objType;
1674 int asText;
1675 const char *zUuid;
1676
1677 if( P("ci") && P("filename") ){
1678 rid = artifact_from_ci_and_filename();
1679 }
1680 if( rid==0 ){
1681 rid = name_to_rid_www("name");
1682 }
1683
1684
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
1560 @ <blockquote><pre>
1561 hexdump(&content);
1562 @ </pre></blockquote>
1563 style_footer();
1564 }
1565
1566 /*
1567 ** Attempt to lookup the specified checkin and file name into an rid.
1568 */
1569 int artifact_from_ci_and_filename(
1570 const char *zCI,
1571 const char *zFilename
1572 ){
1573 int cirid;
1574 Manifest *pManifest;
1575 ManifestFile *pFile;
1576
1577 if( zCI==0 ) return 0;
1578 if( zFilename==0 ) return 0;
1579 cirid = name_to_rid(zCI);
1580 pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
1581 if( pManifest==0 ) return 0;
1582 manifest_file_rewind(pManifest);
1583 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1584 if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1585 int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
1586 manifest_destroy(pManifest);
1587 return rid;
1588 }
1589 }
1590 return 0;
1591 }
1592
1593 /*
1594 ** Look for "ci" and "filename" query parameters. If found, try to
1595 ** use them to extract the record ID of an artifact for the file.
1596 */
1597 int artifact_from_ci_and_filename_www(void){
1598 const char *zFilename;
1599 const char *zCI;
1600 int cirid;
1601 Manifest *pManifest;
1602 ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
1700 int objType;
1701 int asText;
1702 const char *zUuid;
1703
1704 if( P("ci") && P("filename") ){
1705 rid = artifact_from_ci_and_filename_www();
1706 }
1707 if( rid==0 ){
1708 rid = name_to_rid_www("name");
1709 }
1710
1711
+29 -2
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
15601560
@ <blockquote><pre>
15611561
hexdump(&content);
15621562
@ </pre></blockquote>
15631563
style_footer();
15641564
}
1565
+
1566
+/*
1567
+** Attempt to lookup the specified checkin and file name into an rid.
1568
+*/
1569
+int artifact_from_ci_and_filename(
1570
+ const char *zCI,
1571
+ const char *zFilename
1572
+){
1573
+ int cirid;
1574
+ Manifest *pManifest;
1575
+ ManifestFile *pFile;
1576
+
1577
+ if( zCI==0 ) return 0;
1578
+ if( zFilename==0 ) return 0;
1579
+ cirid = name_to_rid(zCI);
1580
+ pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
1581
+ if( pManifest==0 ) return 0;
1582
+ manifest_file_rewind(pManifest);
1583
+ while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1584
+ if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1585
+ int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
1586
+ manifest_destroy(pManifest);
1587
+ return rid;
1588
+ }
1589
+ }
1590
+ return 0;
1591
+}
15651592
15661593
/*
15671594
** Look for "ci" and "filename" query parameters. If found, try to
15681595
** use them to extract the record ID of an artifact for the file.
15691596
*/
1570
-int artifact_from_ci_and_filename(void){
1597
+int artifact_from_ci_and_filename_www(void){
15711598
const char *zFilename;
15721599
const char *zCI;
15731600
int cirid;
15741601
Manifest *pManifest;
15751602
ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
16731700
int objType;
16741701
int asText;
16751702
const char *zUuid;
16761703
16771704
if( P("ci") && P("filename") ){
1678
- rid = artifact_from_ci_and_filename();
1705
+ rid = artifact_from_ci_and_filename_www();
16791706
}
16801707
if( rid==0 ){
16811708
rid = name_to_rid_www("name");
16821709
}
16831710
16841711
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
1560 @ <blockquote><pre>
1561 hexdump(&content);
1562 @ </pre></blockquote>
1563 style_footer();
1564 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1565
1566 /*
1567 ** Look for "ci" and "filename" query parameters. If found, try to
1568 ** use them to extract the record ID of an artifact for the file.
1569 */
1570 int artifact_from_ci_and_filename(void){
1571 const char *zFilename;
1572 const char *zCI;
1573 int cirid;
1574 Manifest *pManifest;
1575 ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
1673 int objType;
1674 int asText;
1675 const char *zUuid;
1676
1677 if( P("ci") && P("filename") ){
1678 rid = artifact_from_ci_and_filename();
1679 }
1680 if( rid==0 ){
1681 rid = name_to_rid_www("name");
1682 }
1683
1684
--- src/info.c
+++ src/info.c
@@ -1560,16 +1560,43 @@
1560 @ <blockquote><pre>
1561 hexdump(&content);
1562 @ </pre></blockquote>
1563 style_footer();
1564 }
1565
1566 /*
1567 ** Attempt to lookup the specified checkin and file name into an rid.
1568 */
1569 int artifact_from_ci_and_filename(
1570 const char *zCI,
1571 const char *zFilename
1572 ){
1573 int cirid;
1574 Manifest *pManifest;
1575 ManifestFile *pFile;
1576
1577 if( zCI==0 ) return 0;
1578 if( zFilename==0 ) return 0;
1579 cirid = name_to_rid(zCI);
1580 pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0);
1581 if( pManifest==0 ) return 0;
1582 manifest_file_rewind(pManifest);
1583 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
1584 if( fossil_strcmp(zFilename, pFile->zName)==0 ){
1585 int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid);
1586 manifest_destroy(pManifest);
1587 return rid;
1588 }
1589 }
1590 return 0;
1591 }
1592
1593 /*
1594 ** Look for "ci" and "filename" query parameters. If found, try to
1595 ** use them to extract the record ID of an artifact for the file.
1596 */
1597 int artifact_from_ci_and_filename_www(void){
1598 const char *zFilename;
1599 const char *zCI;
1600 int cirid;
1601 Manifest *pManifest;
1602 ManifestFile *pFile;
@@ -1673,11 +1700,11 @@
1700 int objType;
1701 int asText;
1702 const char *zUuid;
1703
1704 if( P("ci") && P("filename") ){
1705 rid = artifact_from_ci_and_filename_www();
1706 }
1707 if( rid==0 ){
1708 rid = name_to_rid_www("name");
1709 }
1710
1711
+68 -28
--- src/th_main.c
+++ src/th_main.c
@@ -139,11 +139,11 @@
139139
fossil_print("\n------------------- END TRACE LOG -------------------\n");
140140
}
141141
}
142142
143143
/*
144
-** TH1 command: httpize STRING
144
+** TH1 command: httpize STRING
145145
**
146146
** Escape all characters of STRING which have special meaning in URI
147147
** components. Return a new string result.
148148
*/
149149
static int httpizeCmd(
@@ -167,11 +167,11 @@
167167
** True if output is enabled. False if disabled.
168168
*/
169169
static int enableOutput = 1;
170170
171171
/*
172
-** TH1 command: enable_output BOOLEAN
172
+** TH1 command: enable_output BOOLEAN
173173
**
174174
** Enable or disable the puts and hputs commands.
175175
*/
176176
static int enableOutputCmd(
177177
Th_Interp *interp,
@@ -242,12 +242,12 @@
242242
sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
243243
enableOutput = savedEnable;
244244
}
245245
246246
/*
247
-** TH1 command: puts STRING
248
-** TH1 command: html STRING
247
+** TH1 command: puts STRING
248
+** TH1 command: html STRING
249249
**
250250
** Output STRING escaped for HTML (html) or unchanged (puts).
251251
*/
252252
static int putsCmd(
253253
Th_Interp *interp,
@@ -262,11 +262,11 @@
262262
sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert);
263263
return TH_OK;
264264
}
265265
266266
/*
267
-** TH1 command: wiki STRING
267
+** TH1 command: wiki STRING
268268
**
269269
** Render the input string as wiki.
270270
*/
271271
static int wikiCmd(
272272
Th_Interp *interp,
@@ -287,11 +287,11 @@
287287
}
288288
return TH_OK;
289289
}
290290
291291
/*
292
-** TH1 command: htmlize STRING
292
+** TH1 command: htmlize STRING
293293
**
294294
** Escape all characters of STRING which have special meaning in HTML.
295295
** Return a new string result.
296296
*/
297297
static int htmlizeCmd(
@@ -310,11 +310,11 @@
310310
free(zOut);
311311
return TH_OK;
312312
}
313313
314314
/*
315
-** TH1 command: date
315
+** TH1 command: date
316316
**
317317
** Return a string which is the current time and date. If the
318318
** -local option is used, the date appears using localtime instead
319319
** of UTC.
320320
*/
@@ -335,11 +335,11 @@
335335
free(zOut);
336336
return TH_OK;
337337
}
338338
339339
/*
340
-** TH1 command: hascap STRING...
340
+** TH1 command: hascap STRING...
341341
**
342342
** Return true if the user has all of the capabilities listed in STRING.
343343
*/
344344
static int hascapCmd(
345345
Th_Interp *interp,
@@ -361,11 +361,11 @@
361361
Th_SetResultInt(interp, rc);
362362
return TH_OK;
363363
}
364364
365365
/*
366
-** TH1 command: hasfeature STRING
366
+** TH1 command: hasfeature STRING
367367
**
368368
** Return true if the fossil binary has the given compile-time feature
369369
** enabled. The set of features includes:
370370
**
371371
** "ssl" = FOSSIL_ENABLE_SSL
@@ -439,11 +439,11 @@
439439
return TH_OK;
440440
}
441441
442442
443443
/*
444
-** TH1 command: tclReady
444
+** TH1 command: tclReady
445445
**
446446
** Return true if the fossil binary has the Tcl integration feature
447447
** enabled and it is currently available for use by TH1 scripts.
448448
**
449449
*/
@@ -470,11 +470,11 @@
470470
return TH_OK;
471471
}
472472
473473
474474
/*
475
-** TH1 command: anycap STRING
475
+** TH1 command: anycap STRING
476476
**
477477
** Return true if the user has any one of the capabilities listed in STRING.
478478
*/
479479
static int anycapCmd(
480480
Th_Interp *interp,
@@ -497,11 +497,11 @@
497497
Th_SetResultInt(interp, rc);
498498
return TH_OK;
499499
}
500500
501501
/*
502
-** TH1 command: combobox NAME TEXT-LIST NUMLINES
502
+** TH1 command: combobox NAME TEXT-LIST NUMLINES
503503
**
504504
** Generate an HTML combobox. NAME is both the name of the
505505
** CGI parameter and the name of a variable that contains the
506506
** currently selected value. TEXT-LIST is a list of possible
507507
** values for the combobox. NUMLINES is 1 for a true combobox.
@@ -557,11 +557,11 @@
557557
}
558558
return TH_OK;
559559
}
560560
561561
/*
562
-** TH1 command: linecount STRING MAX MIN
562
+** TH1 command: linecount STRING MAX MIN
563563
**
564564
** Return one more than the number of \n characters in STRING. But
565565
** never return less than MIN or more than MAX.
566566
*/
567567
static int linecntCmd(
@@ -592,11 +592,11 @@
592592
Th_SetResultInt(interp, n);
593593
return TH_OK;
594594
}
595595
596596
/*
597
-** TH1 command: repository ?BOOLEAN?
597
+** TH1 command: repository ?BOOLEAN?
598598
**
599599
** Return the fully qualified file name of the open repository or an empty
600600
** string if one is not currently open. Optionally, it will attempt to open
601601
** the repository if the boolean argument is non-zero.
602602
*/
@@ -620,11 +620,11 @@
620620
Th_SetResult(interp, g.zRepositoryName, -1);
621621
return TH_OK;
622622
}
623623
624624
/*
625
-** TH1 command: checkout ?BOOLEAN?
625
+** TH1 command: checkout ?BOOLEAN?
626626
**
627627
** Return the fully qualified directory name of the current checkout or an
628628
** empty string if it is not available. Optionally, it will attempt to find
629629
** the current checkout, opening the configuration ("user") database and the
630630
** repository as necessary, if the boolean argument is non-zero.
@@ -649,11 +649,11 @@
649649
Th_SetResult(interp, g.zLocalRoot, -1);
650650
return TH_OK;
651651
}
652652
653653
/*
654
-** TH1 command: trace STRING
654
+** TH1 command: trace STRING
655655
**
656656
** Generate a TH1 trace message if debugging is enabled.
657657
*/
658658
static int traceCmd(
659659
Th_Interp *interp,
@@ -671,11 +671,11 @@
671671
Th_SetResult(interp, 0, 0);
672672
return TH_OK;
673673
}
674674
675675
/*
676
-** TH1 command: getParameter NAME ?DEFAULT?
676
+** TH1 command: getParameter NAME ?DEFAULT?
677677
**
678678
** Return the value of the specified query parameter or the specified default
679679
** value when there is no matching query parameter.
680680
*/
681681
static int getParameterCmd(
@@ -695,11 +695,11 @@
695695
Th_SetResult(interp, cgi_parameter(argv[1], zDefault), -1);
696696
return TH_OK;
697697
}
698698
699699
/*
700
-** TH1 command: setParameter NAME VALUE
700
+** TH1 command: setParameter NAME VALUE
701701
**
702702
** Sets the value of the specified query parameter.
703703
*/
704704
static int setParameterCmd(
705705
Th_Interp *interp,
@@ -714,11 +714,11 @@
714714
cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
715715
return TH_OK;
716716
}
717717
718718
/*
719
-** TH1 command: render STRING
719
+** TH1 command: render STRING
720720
**
721721
** Renders the template and writes the results.
722722
*/
723723
static int renderCmd(
724724
Th_Interp *interp,
@@ -735,11 +735,11 @@
735735
Th_SetResult(interp, 0, 0);
736736
return rc;
737737
}
738738
739739
/*
740
-** TH1 command: styleHeader TITLE
740
+** TH1 command: styleHeader TITLE
741741
**
742742
** Render the configured style header.
743743
*/
744744
static int styleHeaderCmd(
745745
Th_Interp *interp,
@@ -760,11 +760,11 @@
760760
return TH_ERROR;
761761
}
762762
}
763763
764764
/*
765
-** TH1 command: styleFooter
765
+** TH1 command: styleFooter
766766
**
767767
** Render the configured style footer.
768768
*/
769769
static int styleFooterCmd(
770770
Th_Interp *interp,
@@ -778,10 +778,49 @@
778778
}
779779
if( Th_IsRepositoryOpen() ){
780780
style_footer();
781781
Th_SetResult(interp, 0, 0);
782782
return TH_OK;
783
+ }else{
784
+ Th_SetResult(interp, "repository unavailable", -1);
785
+ return TH_ERROR;
786
+ }
787
+}
788
+
789
+/*
790
+** TH1 command: artifact ID ?FILENAME?
791
+**
792
+** Attempts to locate the specified artifact and return its contents. An
793
+** error is generated if the repository is not open or the artifact cannot
794
+** be found.
795
+*/
796
+static int artifactCmd(
797
+ Th_Interp *interp,
798
+ void *p,
799
+ int argc,
800
+ const char **argv,
801
+ int *argl
802
+){
803
+ if( argc!=2 && argc!=3 ){
804
+ return Th_WrongNumArgs(interp, "artifact ID ?FILENAME?");
805
+ }
806
+ if( Th_IsRepositoryOpen() ){
807
+ int rid;
808
+ Blob content;
809
+ if( argc==3 ){
810
+ rid = artifact_from_ci_and_filename(argv[1], argv[2]);
811
+ }else{
812
+ rid = name_to_rid(argv[1]);
813
+ }
814
+ if( rid!=0 && content_get(rid, &content) ){
815
+ Th_SetResult(interp, blob_str(&content), blob_size(&content));
816
+ blob_reset(&content);
817
+ return TH_OK;
818
+ }else{
819
+ Th_SetResult(interp, "artifact not found", -1);
820
+ return TH_ERROR;
821
+ }
783822
}else{
784823
Th_SetResult(interp, "repository unavailable", -1);
785824
return TH_ERROR;
786825
}
787826
}
@@ -823,11 +862,11 @@
823862
}
824863
#endif
825864
}
826865
827866
/*
828
-** TH1 command: utime
867
+** TH1 command: utime
829868
**
830869
** Return the number of microseconds of CPU time consumed by the current
831870
** process in user space.
832871
*/
833872
static int utimeCmd(
@@ -844,11 +883,11 @@
844883
Th_SetResult(interp, zUTime, -1);
845884
return TH_OK;
846885
}
847886
848887
/*
849
-** TH1 command: stime
888
+** TH1 command: stime
850889
**
851890
** Return the number of microseconds of CPU time consumed by the current
852891
** process in system space.
853892
*/
854893
static int stimeCmd(
@@ -866,11 +905,11 @@
866905
return TH_OK;
867906
}
868907
869908
870909
/*
871
-** TH1 command: randhex N
910
+** TH1 command: randhex N
872911
**
873912
** Return N*2 random hexadecimal digits with N<50. If N is omitted,
874913
** use a value of 10.
875914
*/
876915
static int randhexCmd(
@@ -900,11 +939,11 @@
900939
Th_SetResult(interp, (const char *)zOut, -1);
901940
return TH_OK;
902941
}
903942
904943
/*
905
-** TH1 command: query SQL CODE
944
+** TH1 command: query SQL CODE
906945
**
907946
** Run the SQL query given by the SQL argument. For each row in the result
908947
** set, run CODE.
909948
**
910949
** In SQL, parameters such as $var are filled in using the value of variable
@@ -982,11 +1021,11 @@
9821021
}
9831022
return res;
9841023
}
9851024
9861025
/*
987
-** TH1 command: setting name
1026
+** TH1 command: setting name
9881027
**
9891028
** Gets and returns the value of the specified Fossil setting.
9901029
*/
9911030
#define SETTING_WRONGNUMARGS "setting ?-strict? ?--? name"
9921031
static int settingCmd(
@@ -1027,11 +1066,11 @@
10271066
}
10281067
return rc;
10291068
}
10301069
10311070
/*
1032
-** TH1 command: regexp ?-nocase? ?--? exp string
1071
+** TH1 command: regexp ?-nocase? ?--? exp string
10331072
**
10341073
** Checks the string against the specified regular expression and returns
10351074
** non-zero if it matches. If the regular expression is invalid or cannot
10361075
** be compiled, an error will be generated.
10371076
*/
@@ -1070,11 +1109,11 @@
10701109
re_free(pRe);
10711110
return rc;
10721111
}
10731112
10741113
/*
1075
-** TH1 command: http ?-asynchronous? ?--? url ?payload?
1114
+** TH1 command: http ?-asynchronous? ?--? url ?payload?
10761115
**
10771116
** Perform an HTTP or HTTPS request for the specified URL. If a
10781117
** payload is present, it will be interpreted as text/plain and
10791118
** the POST method will be used; otherwise, the GET method will
10801119
** be used. Upon success, if the -asynchronous option is used, an
@@ -1244,10 +1283,11 @@
12441283
const char *zName;
12451284
Th_CommandProc xProc;
12461285
void *pContext;
12471286
} aCommand[] = {
12481287
{"anycap", anycapCmd, 0},
1288
+ {"artifact", artifactCmd, 0},
12491289
{"checkout", checkoutCmd, 0},
12501290
{"combobox", comboboxCmd, 0},
12511291
{"date", dateCmd, 0},
12521292
{"decorate", wikiCmd, (void*)&aFlags[2]},
12531293
{"enable_output", enableOutputCmd, 0},
12541294
--- src/th_main.c
+++ src/th_main.c
@@ -139,11 +139,11 @@
139 fossil_print("\n------------------- END TRACE LOG -------------------\n");
140 }
141 }
142
143 /*
144 ** TH1 command: httpize STRING
145 **
146 ** Escape all characters of STRING which have special meaning in URI
147 ** components. Return a new string result.
148 */
149 static int httpizeCmd(
@@ -167,11 +167,11 @@
167 ** True if output is enabled. False if disabled.
168 */
169 static int enableOutput = 1;
170
171 /*
172 ** TH1 command: enable_output BOOLEAN
173 **
174 ** Enable or disable the puts and hputs commands.
175 */
176 static int enableOutputCmd(
177 Th_Interp *interp,
@@ -242,12 +242,12 @@
242 sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
243 enableOutput = savedEnable;
244 }
245
246 /*
247 ** TH1 command: puts STRING
248 ** TH1 command: html STRING
249 **
250 ** Output STRING escaped for HTML (html) or unchanged (puts).
251 */
252 static int putsCmd(
253 Th_Interp *interp,
@@ -262,11 +262,11 @@
262 sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert);
263 return TH_OK;
264 }
265
266 /*
267 ** TH1 command: wiki STRING
268 **
269 ** Render the input string as wiki.
270 */
271 static int wikiCmd(
272 Th_Interp *interp,
@@ -287,11 +287,11 @@
287 }
288 return TH_OK;
289 }
290
291 /*
292 ** TH1 command: htmlize STRING
293 **
294 ** Escape all characters of STRING which have special meaning in HTML.
295 ** Return a new string result.
296 */
297 static int htmlizeCmd(
@@ -310,11 +310,11 @@
310 free(zOut);
311 return TH_OK;
312 }
313
314 /*
315 ** TH1 command: date
316 **
317 ** Return a string which is the current time and date. If the
318 ** -local option is used, the date appears using localtime instead
319 ** of UTC.
320 */
@@ -335,11 +335,11 @@
335 free(zOut);
336 return TH_OK;
337 }
338
339 /*
340 ** TH1 command: hascap STRING...
341 **
342 ** Return true if the user has all of the capabilities listed in STRING.
343 */
344 static int hascapCmd(
345 Th_Interp *interp,
@@ -361,11 +361,11 @@
361 Th_SetResultInt(interp, rc);
362 return TH_OK;
363 }
364
365 /*
366 ** TH1 command: hasfeature STRING
367 **
368 ** Return true if the fossil binary has the given compile-time feature
369 ** enabled. The set of features includes:
370 **
371 ** "ssl" = FOSSIL_ENABLE_SSL
@@ -439,11 +439,11 @@
439 return TH_OK;
440 }
441
442
443 /*
444 ** TH1 command: tclReady
445 **
446 ** Return true if the fossil binary has the Tcl integration feature
447 ** enabled and it is currently available for use by TH1 scripts.
448 **
449 */
@@ -470,11 +470,11 @@
470 return TH_OK;
471 }
472
473
474 /*
475 ** TH1 command: anycap STRING
476 **
477 ** Return true if the user has any one of the capabilities listed in STRING.
478 */
479 static int anycapCmd(
480 Th_Interp *interp,
@@ -497,11 +497,11 @@
497 Th_SetResultInt(interp, rc);
498 return TH_OK;
499 }
500
501 /*
502 ** TH1 command: combobox NAME TEXT-LIST NUMLINES
503 **
504 ** Generate an HTML combobox. NAME is both the name of the
505 ** CGI parameter and the name of a variable that contains the
506 ** currently selected value. TEXT-LIST is a list of possible
507 ** values for the combobox. NUMLINES is 1 for a true combobox.
@@ -557,11 +557,11 @@
557 }
558 return TH_OK;
559 }
560
561 /*
562 ** TH1 command: linecount STRING MAX MIN
563 **
564 ** Return one more than the number of \n characters in STRING. But
565 ** never return less than MIN or more than MAX.
566 */
567 static int linecntCmd(
@@ -592,11 +592,11 @@
592 Th_SetResultInt(interp, n);
593 return TH_OK;
594 }
595
596 /*
597 ** TH1 command: repository ?BOOLEAN?
598 **
599 ** Return the fully qualified file name of the open repository or an empty
600 ** string if one is not currently open. Optionally, it will attempt to open
601 ** the repository if the boolean argument is non-zero.
602 */
@@ -620,11 +620,11 @@
620 Th_SetResult(interp, g.zRepositoryName, -1);
621 return TH_OK;
622 }
623
624 /*
625 ** TH1 command: checkout ?BOOLEAN?
626 **
627 ** Return the fully qualified directory name of the current checkout or an
628 ** empty string if it is not available. Optionally, it will attempt to find
629 ** the current checkout, opening the configuration ("user") database and the
630 ** repository as necessary, if the boolean argument is non-zero.
@@ -649,11 +649,11 @@
649 Th_SetResult(interp, g.zLocalRoot, -1);
650 return TH_OK;
651 }
652
653 /*
654 ** TH1 command: trace STRING
655 **
656 ** Generate a TH1 trace message if debugging is enabled.
657 */
658 static int traceCmd(
659 Th_Interp *interp,
@@ -671,11 +671,11 @@
671 Th_SetResult(interp, 0, 0);
672 return TH_OK;
673 }
674
675 /*
676 ** TH1 command: getParameter NAME ?DEFAULT?
677 **
678 ** Return the value of the specified query parameter or the specified default
679 ** value when there is no matching query parameter.
680 */
681 static int getParameterCmd(
@@ -695,11 +695,11 @@
695 Th_SetResult(interp, cgi_parameter(argv[1], zDefault), -1);
696 return TH_OK;
697 }
698
699 /*
700 ** TH1 command: setParameter NAME VALUE
701 **
702 ** Sets the value of the specified query parameter.
703 */
704 static int setParameterCmd(
705 Th_Interp *interp,
@@ -714,11 +714,11 @@
714 cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
715 return TH_OK;
716 }
717
718 /*
719 ** TH1 command: render STRING
720 **
721 ** Renders the template and writes the results.
722 */
723 static int renderCmd(
724 Th_Interp *interp,
@@ -735,11 +735,11 @@
735 Th_SetResult(interp, 0, 0);
736 return rc;
737 }
738
739 /*
740 ** TH1 command: styleHeader TITLE
741 **
742 ** Render the configured style header.
743 */
744 static int styleHeaderCmd(
745 Th_Interp *interp,
@@ -760,11 +760,11 @@
760 return TH_ERROR;
761 }
762 }
763
764 /*
765 ** TH1 command: styleFooter
766 **
767 ** Render the configured style footer.
768 */
769 static int styleFooterCmd(
770 Th_Interp *interp,
@@ -778,10 +778,49 @@
778 }
779 if( Th_IsRepositoryOpen() ){
780 style_footer();
781 Th_SetResult(interp, 0, 0);
782 return TH_OK;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783 }else{
784 Th_SetResult(interp, "repository unavailable", -1);
785 return TH_ERROR;
786 }
787 }
@@ -823,11 +862,11 @@
823 }
824 #endif
825 }
826
827 /*
828 ** TH1 command: utime
829 **
830 ** Return the number of microseconds of CPU time consumed by the current
831 ** process in user space.
832 */
833 static int utimeCmd(
@@ -844,11 +883,11 @@
844 Th_SetResult(interp, zUTime, -1);
845 return TH_OK;
846 }
847
848 /*
849 ** TH1 command: stime
850 **
851 ** Return the number of microseconds of CPU time consumed by the current
852 ** process in system space.
853 */
854 static int stimeCmd(
@@ -866,11 +905,11 @@
866 return TH_OK;
867 }
868
869
870 /*
871 ** TH1 command: randhex N
872 **
873 ** Return N*2 random hexadecimal digits with N<50. If N is omitted,
874 ** use a value of 10.
875 */
876 static int randhexCmd(
@@ -900,11 +939,11 @@
900 Th_SetResult(interp, (const char *)zOut, -1);
901 return TH_OK;
902 }
903
904 /*
905 ** TH1 command: query SQL CODE
906 **
907 ** Run the SQL query given by the SQL argument. For each row in the result
908 ** set, run CODE.
909 **
910 ** In SQL, parameters such as $var are filled in using the value of variable
@@ -982,11 +1021,11 @@
982 }
983 return res;
984 }
985
986 /*
987 ** TH1 command: setting name
988 **
989 ** Gets and returns the value of the specified Fossil setting.
990 */
991 #define SETTING_WRONGNUMARGS "setting ?-strict? ?--? name"
992 static int settingCmd(
@@ -1027,11 +1066,11 @@
1027 }
1028 return rc;
1029 }
1030
1031 /*
1032 ** TH1 command: regexp ?-nocase? ?--? exp string
1033 **
1034 ** Checks the string against the specified regular expression and returns
1035 ** non-zero if it matches. If the regular expression is invalid or cannot
1036 ** be compiled, an error will be generated.
1037 */
@@ -1070,11 +1109,11 @@
1070 re_free(pRe);
1071 return rc;
1072 }
1073
1074 /*
1075 ** TH1 command: http ?-asynchronous? ?--? url ?payload?
1076 **
1077 ** Perform an HTTP or HTTPS request for the specified URL. If a
1078 ** payload is present, it will be interpreted as text/plain and
1079 ** the POST method will be used; otherwise, the GET method will
1080 ** be used. Upon success, if the -asynchronous option is used, an
@@ -1244,10 +1283,11 @@
1244 const char *zName;
1245 Th_CommandProc xProc;
1246 void *pContext;
1247 } aCommand[] = {
1248 {"anycap", anycapCmd, 0},
 
1249 {"checkout", checkoutCmd, 0},
1250 {"combobox", comboboxCmd, 0},
1251 {"date", dateCmd, 0},
1252 {"decorate", wikiCmd, (void*)&aFlags[2]},
1253 {"enable_output", enableOutputCmd, 0},
1254
--- src/th_main.c
+++ src/th_main.c
@@ -139,11 +139,11 @@
139 fossil_print("\n------------------- END TRACE LOG -------------------\n");
140 }
141 }
142
143 /*
144 ** TH1 command: httpize STRING
145 **
146 ** Escape all characters of STRING which have special meaning in URI
147 ** components. Return a new string result.
148 */
149 static int httpizeCmd(
@@ -167,11 +167,11 @@
167 ** True if output is enabled. False if disabled.
168 */
169 static int enableOutput = 1;
170
171 /*
172 ** TH1 command: enable_output BOOLEAN
173 **
174 ** Enable or disable the puts and hputs commands.
175 */
176 static int enableOutputCmd(
177 Th_Interp *interp,
@@ -242,12 +242,12 @@
242 sendText(forceCgi || g.cgiOutput ? "</p>" : "\n", -1, 0);
243 enableOutput = savedEnable;
244 }
245
246 /*
247 ** TH1 command: puts STRING
248 ** TH1 command: html STRING
249 **
250 ** Output STRING escaped for HTML (html) or unchanged (puts).
251 */
252 static int putsCmd(
253 Th_Interp *interp,
@@ -262,11 +262,11 @@
262 sendText((char*)argv[1], argl[1], *(unsigned int*)pConvert);
263 return TH_OK;
264 }
265
266 /*
267 ** TH1 command: wiki STRING
268 **
269 ** Render the input string as wiki.
270 */
271 static int wikiCmd(
272 Th_Interp *interp,
@@ -287,11 +287,11 @@
287 }
288 return TH_OK;
289 }
290
291 /*
292 ** TH1 command: htmlize STRING
293 **
294 ** Escape all characters of STRING which have special meaning in HTML.
295 ** Return a new string result.
296 */
297 static int htmlizeCmd(
@@ -310,11 +310,11 @@
310 free(zOut);
311 return TH_OK;
312 }
313
314 /*
315 ** TH1 command: date
316 **
317 ** Return a string which is the current time and date. If the
318 ** -local option is used, the date appears using localtime instead
319 ** of UTC.
320 */
@@ -335,11 +335,11 @@
335 free(zOut);
336 return TH_OK;
337 }
338
339 /*
340 ** TH1 command: hascap STRING...
341 **
342 ** Return true if the user has all of the capabilities listed in STRING.
343 */
344 static int hascapCmd(
345 Th_Interp *interp,
@@ -361,11 +361,11 @@
361 Th_SetResultInt(interp, rc);
362 return TH_OK;
363 }
364
365 /*
366 ** TH1 command: hasfeature STRING
367 **
368 ** Return true if the fossil binary has the given compile-time feature
369 ** enabled. The set of features includes:
370 **
371 ** "ssl" = FOSSIL_ENABLE_SSL
@@ -439,11 +439,11 @@
439 return TH_OK;
440 }
441
442
443 /*
444 ** TH1 command: tclReady
445 **
446 ** Return true if the fossil binary has the Tcl integration feature
447 ** enabled and it is currently available for use by TH1 scripts.
448 **
449 */
@@ -470,11 +470,11 @@
470 return TH_OK;
471 }
472
473
474 /*
475 ** TH1 command: anycap STRING
476 **
477 ** Return true if the user has any one of the capabilities listed in STRING.
478 */
479 static int anycapCmd(
480 Th_Interp *interp,
@@ -497,11 +497,11 @@
497 Th_SetResultInt(interp, rc);
498 return TH_OK;
499 }
500
501 /*
502 ** TH1 command: combobox NAME TEXT-LIST NUMLINES
503 **
504 ** Generate an HTML combobox. NAME is both the name of the
505 ** CGI parameter and the name of a variable that contains the
506 ** currently selected value. TEXT-LIST is a list of possible
507 ** values for the combobox. NUMLINES is 1 for a true combobox.
@@ -557,11 +557,11 @@
557 }
558 return TH_OK;
559 }
560
561 /*
562 ** TH1 command: linecount STRING MAX MIN
563 **
564 ** Return one more than the number of \n characters in STRING. But
565 ** never return less than MIN or more than MAX.
566 */
567 static int linecntCmd(
@@ -592,11 +592,11 @@
592 Th_SetResultInt(interp, n);
593 return TH_OK;
594 }
595
596 /*
597 ** TH1 command: repository ?BOOLEAN?
598 **
599 ** Return the fully qualified file name of the open repository or an empty
600 ** string if one is not currently open. Optionally, it will attempt to open
601 ** the repository if the boolean argument is non-zero.
602 */
@@ -620,11 +620,11 @@
620 Th_SetResult(interp, g.zRepositoryName, -1);
621 return TH_OK;
622 }
623
624 /*
625 ** TH1 command: checkout ?BOOLEAN?
626 **
627 ** Return the fully qualified directory name of the current checkout or an
628 ** empty string if it is not available. Optionally, it will attempt to find
629 ** the current checkout, opening the configuration ("user") database and the
630 ** repository as necessary, if the boolean argument is non-zero.
@@ -649,11 +649,11 @@
649 Th_SetResult(interp, g.zLocalRoot, -1);
650 return TH_OK;
651 }
652
653 /*
654 ** TH1 command: trace STRING
655 **
656 ** Generate a TH1 trace message if debugging is enabled.
657 */
658 static int traceCmd(
659 Th_Interp *interp,
@@ -671,11 +671,11 @@
671 Th_SetResult(interp, 0, 0);
672 return TH_OK;
673 }
674
675 /*
676 ** TH1 command: getParameter NAME ?DEFAULT?
677 **
678 ** Return the value of the specified query parameter or the specified default
679 ** value when there is no matching query parameter.
680 */
681 static int getParameterCmd(
@@ -695,11 +695,11 @@
695 Th_SetResult(interp, cgi_parameter(argv[1], zDefault), -1);
696 return TH_OK;
697 }
698
699 /*
700 ** TH1 command: setParameter NAME VALUE
701 **
702 ** Sets the value of the specified query parameter.
703 */
704 static int setParameterCmd(
705 Th_Interp *interp,
@@ -714,11 +714,11 @@
714 cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
715 return TH_OK;
716 }
717
718 /*
719 ** TH1 command: render STRING
720 **
721 ** Renders the template and writes the results.
722 */
723 static int renderCmd(
724 Th_Interp *interp,
@@ -735,11 +735,11 @@
735 Th_SetResult(interp, 0, 0);
736 return rc;
737 }
738
739 /*
740 ** TH1 command: styleHeader TITLE
741 **
742 ** Render the configured style header.
743 */
744 static int styleHeaderCmd(
745 Th_Interp *interp,
@@ -760,11 +760,11 @@
760 return TH_ERROR;
761 }
762 }
763
764 /*
765 ** TH1 command: styleFooter
766 **
767 ** Render the configured style footer.
768 */
769 static int styleFooterCmd(
770 Th_Interp *interp,
@@ -778,10 +778,49 @@
778 }
779 if( Th_IsRepositoryOpen() ){
780 style_footer();
781 Th_SetResult(interp, 0, 0);
782 return TH_OK;
783 }else{
784 Th_SetResult(interp, "repository unavailable", -1);
785 return TH_ERROR;
786 }
787 }
788
789 /*
790 ** TH1 command: artifact ID ?FILENAME?
791 **
792 ** Attempts to locate the specified artifact and return its contents. An
793 ** error is generated if the repository is not open or the artifact cannot
794 ** be found.
795 */
796 static int artifactCmd(
797 Th_Interp *interp,
798 void *p,
799 int argc,
800 const char **argv,
801 int *argl
802 ){
803 if( argc!=2 && argc!=3 ){
804 return Th_WrongNumArgs(interp, "artifact ID ?FILENAME?");
805 }
806 if( Th_IsRepositoryOpen() ){
807 int rid;
808 Blob content;
809 if( argc==3 ){
810 rid = artifact_from_ci_and_filename(argv[1], argv[2]);
811 }else{
812 rid = name_to_rid(argv[1]);
813 }
814 if( rid!=0 && content_get(rid, &content) ){
815 Th_SetResult(interp, blob_str(&content), blob_size(&content));
816 blob_reset(&content);
817 return TH_OK;
818 }else{
819 Th_SetResult(interp, "artifact not found", -1);
820 return TH_ERROR;
821 }
822 }else{
823 Th_SetResult(interp, "repository unavailable", -1);
824 return TH_ERROR;
825 }
826 }
@@ -823,11 +862,11 @@
862 }
863 #endif
864 }
865
866 /*
867 ** TH1 command: utime
868 **
869 ** Return the number of microseconds of CPU time consumed by the current
870 ** process in user space.
871 */
872 static int utimeCmd(
@@ -844,11 +883,11 @@
883 Th_SetResult(interp, zUTime, -1);
884 return TH_OK;
885 }
886
887 /*
888 ** TH1 command: stime
889 **
890 ** Return the number of microseconds of CPU time consumed by the current
891 ** process in system space.
892 */
893 static int stimeCmd(
@@ -866,11 +905,11 @@
905 return TH_OK;
906 }
907
908
909 /*
910 ** TH1 command: randhex N
911 **
912 ** Return N*2 random hexadecimal digits with N<50. If N is omitted,
913 ** use a value of 10.
914 */
915 static int randhexCmd(
@@ -900,11 +939,11 @@
939 Th_SetResult(interp, (const char *)zOut, -1);
940 return TH_OK;
941 }
942
943 /*
944 ** TH1 command: query SQL CODE
945 **
946 ** Run the SQL query given by the SQL argument. For each row in the result
947 ** set, run CODE.
948 **
949 ** In SQL, parameters such as $var are filled in using the value of variable
@@ -982,11 +1021,11 @@
1021 }
1022 return res;
1023 }
1024
1025 /*
1026 ** TH1 command: setting name
1027 **
1028 ** Gets and returns the value of the specified Fossil setting.
1029 */
1030 #define SETTING_WRONGNUMARGS "setting ?-strict? ?--? name"
1031 static int settingCmd(
@@ -1027,11 +1066,11 @@
1066 }
1067 return rc;
1068 }
1069
1070 /*
1071 ** TH1 command: regexp ?-nocase? ?--? exp string
1072 **
1073 ** Checks the string against the specified regular expression and returns
1074 ** non-zero if it matches. If the regular expression is invalid or cannot
1075 ** be compiled, an error will be generated.
1076 */
@@ -1070,11 +1109,11 @@
1109 re_free(pRe);
1110 return rc;
1111 }
1112
1113 /*
1114 ** TH1 command: http ?-asynchronous? ?--? url ?payload?
1115 **
1116 ** Perform an HTTP or HTTPS request for the specified URL. If a
1117 ** payload is present, it will be interpreted as text/plain and
1118 ** the POST method will be used; otherwise, the GET method will
1119 ** be used. Upon success, if the -asynchronous option is used, an
@@ -1244,10 +1283,11 @@
1283 const char *zName;
1284 Th_CommandProc xProc;
1285 void *pContext;
1286 } aCommand[] = {
1287 {"anycap", anycapCmd, 0},
1288 {"artifact", artifactCmd, 0},
1289 {"checkout", checkoutCmd, 0},
1290 {"combobox", comboboxCmd, 0},
1291 {"date", dateCmd, 0},
1292 {"decorate", wikiCmd, (void*)&aFlags[2]},
1293 {"enable_output", enableOutputCmd, 0},
1294
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474474
475475
style_footer();
476476
}
477477
478478
/*
479
-** TH1 command: append_field FIELD STRING
479
+** TH1 command: append_field FIELD STRING
480480
**
481481
** FIELD is the name of a database column to which we might want
482482
** to append text. STRING is the text to be appended to that
483483
** column. The append does not actually occur until the
484484
** submit_ticket command is run.
485485
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474
475 style_footer();
476 }
477
478 /*
479 ** TH1 command: append_field FIELD STRING
480 **
481 ** FIELD is the name of a database column to which we might want
482 ** to append text. STRING is the text to be appended to that
483 ** column. The append does not actually occur until the
484 ** submit_ticket command is run.
485
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474
475 style_footer();
476 }
477
478 /*
479 ** TH1 command: append_field FIELD STRING
480 **
481 ** FIELD is the name of a database column to which we might want
482 ** to append text. STRING is the text to be appended to that
483 ** column. The append does not actually occur until the
484 ** submit_ticket command is run.
485
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474474
475475
style_footer();
476476
}
477477
478478
/*
479
-** TH1 command: append_field FIELD STRING
479
+** TH1 command: append_field FIELD STRING
480480
**
481481
** FIELD is the name of a database column to which we might want
482482
** to append text. STRING is the text to be appended to that
483483
** column. The append does not actually occur until the
484484
** submit_ticket command is run.
485485
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474
475 style_footer();
476 }
477
478 /*
479 ** TH1 command: append_field FIELD STRING
480 **
481 ** FIELD is the name of a database column to which we might want
482 ** to append text. STRING is the text to be appended to that
483 ** column. The append does not actually occur until the
484 ** submit_ticket command is run.
485
--- src/tkt.c
+++ src/tkt.c
@@ -474,11 +474,11 @@
474
475 style_footer();
476 }
477
478 /*
479 ** TH1 command: append_field FIELD STRING
480 **
481 ** FIELD is the name of a database column to which we might want
482 ** to append text. STRING is the text to be appended to that
483 ** column. The append does not actually occur until the
484 ** submit_ticket command is run.
485
--- test/th1.test
+++ test/th1.test
@@ -630,5 +630,51 @@
630630
631631
###############################################################################
632632
633633
fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
634634
test th1-set-parameter-7 {$RESULT eq {value5}}
635
+
636
+###############################################################################
637
+
638
+fossil test-th-eval "artifact"
639
+test th1-artifact-1 {$RESULT eq \
640
+ {TH_ERROR: wrong # args: should be "artifact ID ?FILENAME?"}}
641
+
642
+###############################################################################
643
+
644
+fossil test-th-eval "artifact tip"
645
+test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}
646
+
647
+###############################################################################
648
+
649
+fossil test-th-eval --th-open-config "artifact tip"
650
+test th1-artifact-3 {[regexp -- {F test/th1\.test [0-9a-f]{40}} $RESULT]}
651
+
652
+###############################################################################
653
+
654
+fossil test-th-eval "artifact 0000000000"
655
+test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}}
656
+
657
+###############################################################################
658
+
659
+fossil test-th-eval --th-open-config "artifact 0000000000"
660
+test th1-artifact-5 {$RESULT eq {TH_ERROR: artifact not found}}
661
+
662
+###############################################################################
663
+
664
+fossil test-th-eval "artifact tip test/th1.test"
665
+test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}}
666
+
667
+###############################################################################
668
+
669
+fossil test-th-eval --th-open-config "artifact tip test/th1.test"
670
+test th1-artifact-7 {[regexp -- {th1-artifact-7} $RESULT]}
671
+
672
+###############################################################################
673
+
674
+fossil test-th-eval "artifact 0000000000 test/th1.test"
675
+test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}}
676
+
677
+###############################################################################
678
+
679
+fossil test-th-eval --th-open-config "artifact 0000000000 test/th1.test"
680
+test th1-artifact-9 {$RESULT eq {TH_ERROR: artifact not found}}
635681
--- test/th1.test
+++ test/th1.test
@@ -630,5 +630,51 @@
630
631 ###############################################################################
632
633 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
634 test th1-set-parameter-7 {$RESULT eq {value5}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
--- test/th1.test
+++ test/th1.test
@@ -630,5 +630,51 @@
630
631 ###############################################################################
632
633 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
634 test th1-set-parameter-7 {$RESULT eq {value5}}
635
636 ###############################################################################
637
638 fossil test-th-eval "artifact"
639 test th1-artifact-1 {$RESULT eq \
640 {TH_ERROR: wrong # args: should be "artifact ID ?FILENAME?"}}
641
642 ###############################################################################
643
644 fossil test-th-eval "artifact tip"
645 test th1-artifact-2 {$RESULT eq {TH_ERROR: repository unavailable}}
646
647 ###############################################################################
648
649 fossil test-th-eval --th-open-config "artifact tip"
650 test th1-artifact-3 {[regexp -- {F test/th1\.test [0-9a-f]{40}} $RESULT]}
651
652 ###############################################################################
653
654 fossil test-th-eval "artifact 0000000000"
655 test th1-artifact-4 {$RESULT eq {TH_ERROR: repository unavailable}}
656
657 ###############################################################################
658
659 fossil test-th-eval --th-open-config "artifact 0000000000"
660 test th1-artifact-5 {$RESULT eq {TH_ERROR: artifact not found}}
661
662 ###############################################################################
663
664 fossil test-th-eval "artifact tip test/th1.test"
665 test th1-artifact-6 {$RESULT eq {TH_ERROR: repository unavailable}}
666
667 ###############################################################################
668
669 fossil test-th-eval --th-open-config "artifact tip test/th1.test"
670 test th1-artifact-7 {[regexp -- {th1-artifact-7} $RESULT]}
671
672 ###############################################################################
673
674 fossil test-th-eval "artifact 0000000000 test/th1.test"
675 test th1-artifact-8 {$RESULT eq {TH_ERROR: repository unavailable}}
676
677 ###############################################################################
678
679 fossil test-th-eval --th-open-config "artifact 0000000000 test/th1.test"
680 test th1-artifact-9 {$RESULT eq {TH_ERROR: artifact not found}}
681
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,10 +4,17 @@
44
* Add setting to control the number of times autosync will be tried before
55
returning an error.
66
* Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
77
at the given DIRECTORY and populates it with read-only copies of all
88
historical check-ins. This only works on systems that support FuseFS.
9
+ * Support customization of commands and webpages, including the ability to
10
+ add new ones, via the "TH1 hooks" feature. Disabled by default. Enabled
11
+ via a compile-time option.
12
+ * Add the <nowiki>[checkout], [render], [styleHeader], [styleFooter],
13
+ [trace], [getParameter], [setParameter], and [artifact]</nowiki> commands
14
+ to TH1, primarily for use by TH1 hooks.
15
+ * Bring in the latest version of autosetup from upstream.
916
1017
<h2>Changes For Version 1.29 (2014-06-12)</h2>
1118
* Add the ability to display content, diffs and annotations for UTF16
1219
text files in the web interface.
1320
* Add the "SaveAs..." and "Invert" buttons
1421
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,10 +4,17 @@
4 * Add setting to control the number of times autosync will be tried before
5 returning an error.
6 * Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
7 at the given DIRECTORY and populates it with read-only copies of all
8 historical check-ins. This only works on systems that support FuseFS.
 
 
 
 
 
 
 
9
10 <h2>Changes For Version 1.29 (2014-06-12)</h2>
11 * Add the ability to display content, diffs and annotations for UTF16
12 text files in the web interface.
13 * Add the "SaveAs..." and "Invert" buttons
14
--- www/changes.wiki
+++ www/changes.wiki
@@ -4,10 +4,17 @@
4 * Add setting to control the number of times autosync will be tried before
5 returning an error.
6 * Add the "fossil fusefs DIRECTORY" command that mounts a Fuse Filesystem
7 at the given DIRECTORY and populates it with read-only copies of all
8 historical check-ins. This only works on systems that support FuseFS.
9 * Support customization of commands and webpages, including the ability to
10 add new ones, via the "TH1 hooks" feature. Disabled by default. Enabled
11 via a compile-time option.
12 * Add the <nowiki>[checkout], [render], [styleHeader], [styleFooter],
13 [trace], [getParameter], [setParameter], and [artifact]</nowiki> commands
14 to TH1, primarily for use by TH1 hooks.
15 * Bring in the latest version of autosetup from upstream.
16
17 <h2>Changes For Version 1.29 (2014-06-12)</h2>
18 * Add the ability to display content, diffs and annotations for UTF16
19 text files in the web interface.
20 * Add the "SaveAs..." and "Invert" buttons
21

Keyboard Shortcuts

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