Fossil SCM

Merge in the trunk changes.

drh 2012-06-29 15:47 UTC sqlite4 merge
Commit 0315f3f03bd9b6786550628e07e06b6b25736cc6
+9 -8
--- src/checkin.c
+++ src/checkin.c
@@ -42,11 +42,11 @@
4242
int nErr = 0;
4343
Blob rewrittenPathname;
4444
db_prepare(&q,
4545
"SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
4646
" FROM vfile "
47
- " WHERE file_is_selected(id)"
47
+ " WHERE is_selected(id)"
4848
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
4949
);
5050
blob_zero(&rewrittenPathname);
5151
while( db_step(&q)==SQLITE_ROW ){
5252
const char *zPathname = db_column_text(&q,0);
@@ -682,15 +682,16 @@
682682
zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
683683
blob_appendf(pOut, "D %s\n", zDate);
684684
zDate[10] = ' ';
685685
db_prepare(&q,
686686
"SELECT pathname, uuid, origname, blob.rid, isexe, islink,"
687
- " file_is_selected(vfile.id)"
687
+ " is_selected(vfile.id)"
688688
" FROM vfile JOIN blob ON vfile.mrid=blob.rid"
689
- " WHERE (NOT deleted OR NOT file_is_selected(vfile.id))"
689
+ " WHERE (NOT deleted OR NOT is_selected(vfile.id))"
690690
" AND vfile.vid=%d"
691
- " ORDER BY 1", vid);
691
+ " ORDER BY if_selected(vfile.id, pathname, origname)",
692
+ vid);
692693
blob_zero(&filename);
693694
blob_appendf(&filename, "%s", g.zLocalRoot);
694695
nBasename = blob_size(&filename);
695696
while( db_step(&q)==SQLITE_ROW ){
696697
const char *zName = db_column_text(&q, 0);
@@ -1090,11 +1091,11 @@
10901091
Blob unmodified;
10911092
memset(&unmodified, 0, sizeof(Blob));
10921093
blob_init(&unmodified, 0, 0);
10931094
db_blob(&unmodified,
10941095
"SELECT pathname FROM vfile"
1095
- " WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)"
1096
+ " WHERE chnged = 0 AND origname IS NULL AND is_selected(id)"
10961097
);
10971098
if( strlen(blob_str(&unmodified)) ){
10981099
fossil_fatal("file %s has not changed", blob_str(&unmodified));
10991100
}
11001101
}
@@ -1151,11 +1152,11 @@
11511152
** table. If there were arguments passed to this command, only
11521153
** the identified fils are inserted (if they have been modified).
11531154
*/
11541155
db_prepare(&q,
11551156
"SELECT id, %Q || pathname, mrid, %s FROM vfile "
1156
- "WHERE chnged==1 AND NOT deleted AND file_is_selected(id)",
1157
+ "WHERE chnged==1 AND NOT deleted AND is_selected(id)",
11571158
g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob",""))
11581159
);
11591160
while( db_step(&q)==SQLITE_ROW ){
11601161
int id, rid;
11611162
const char *zFullname;
@@ -1289,15 +1290,15 @@
12891290
}
12901291
12911292
12921293
/* Update the vfile and vmerge tables */
12931294
db_multi_exec(
1294
- "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1295
+ "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);"
12951296
"DELETE FROM vmerge;"
12961297
"UPDATE vfile SET vid=%d;"
12971298
"UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
1298
- " WHERE file_is_selected(id);"
1299
+ " WHERE is_selected(id);"
12991300
, vid, nvid
13001301
);
13011302
db_lset_int("checkout", nvid);
13021303
13031304
if( useCksum ){
13041305
--- src/checkin.c
+++ src/checkin.c
@@ -42,11 +42,11 @@
42 int nErr = 0;
43 Blob rewrittenPathname;
44 db_prepare(&q,
45 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
46 " FROM vfile "
47 " WHERE file_is_selected(id)"
48 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
49 );
50 blob_zero(&rewrittenPathname);
51 while( db_step(&q)==SQLITE_ROW ){
52 const char *zPathname = db_column_text(&q,0);
@@ -682,15 +682,16 @@
682 zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
683 blob_appendf(pOut, "D %s\n", zDate);
684 zDate[10] = ' ';
685 db_prepare(&q,
686 "SELECT pathname, uuid, origname, blob.rid, isexe, islink,"
687 " file_is_selected(vfile.id)"
688 " FROM vfile JOIN blob ON vfile.mrid=blob.rid"
689 " WHERE (NOT deleted OR NOT file_is_selected(vfile.id))"
690 " AND vfile.vid=%d"
691 " ORDER BY 1", vid);
 
692 blob_zero(&filename);
693 blob_appendf(&filename, "%s", g.zLocalRoot);
694 nBasename = blob_size(&filename);
695 while( db_step(&q)==SQLITE_ROW ){
696 const char *zName = db_column_text(&q, 0);
@@ -1090,11 +1091,11 @@
1090 Blob unmodified;
1091 memset(&unmodified, 0, sizeof(Blob));
1092 blob_init(&unmodified, 0, 0);
1093 db_blob(&unmodified,
1094 "SELECT pathname FROM vfile"
1095 " WHERE chnged = 0 AND origname IS NULL AND file_is_selected(id)"
1096 );
1097 if( strlen(blob_str(&unmodified)) ){
1098 fossil_fatal("file %s has not changed", blob_str(&unmodified));
1099 }
1100 }
@@ -1151,11 +1152,11 @@
1151 ** table. If there were arguments passed to this command, only
1152 ** the identified fils are inserted (if they have been modified).
1153 */
1154 db_prepare(&q,
1155 "SELECT id, %Q || pathname, mrid, %s FROM vfile "
1156 "WHERE chnged==1 AND NOT deleted AND file_is_selected(id)",
1157 g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob",""))
1158 );
1159 while( db_step(&q)==SQLITE_ROW ){
1160 int id, rid;
1161 const char *zFullname;
@@ -1289,15 +1290,15 @@
1289 }
1290
1291
1292 /* Update the vfile and vmerge tables */
1293 db_multi_exec(
1294 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1295 "DELETE FROM vmerge;"
1296 "UPDATE vfile SET vid=%d;"
1297 "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
1298 " WHERE file_is_selected(id);"
1299 , vid, nvid
1300 );
1301 db_lset_int("checkout", nvid);
1302
1303 if( useCksum ){
1304
--- src/checkin.c
+++ src/checkin.c
@@ -42,11 +42,11 @@
42 int nErr = 0;
43 Blob rewrittenPathname;
44 db_prepare(&q,
45 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
46 " FROM vfile "
47 " WHERE is_selected(id)"
48 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
49 );
50 blob_zero(&rewrittenPathname);
51 while( db_step(&q)==SQLITE_ROW ){
52 const char *zPathname = db_column_text(&q,0);
@@ -682,15 +682,16 @@
682 zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now");
683 blob_appendf(pOut, "D %s\n", zDate);
684 zDate[10] = ' ';
685 db_prepare(&q,
686 "SELECT pathname, uuid, origname, blob.rid, isexe, islink,"
687 " is_selected(vfile.id)"
688 " FROM vfile JOIN blob ON vfile.mrid=blob.rid"
689 " WHERE (NOT deleted OR NOT is_selected(vfile.id))"
690 " AND vfile.vid=%d"
691 " ORDER BY if_selected(vfile.id, pathname, origname)",
692 vid);
693 blob_zero(&filename);
694 blob_appendf(&filename, "%s", g.zLocalRoot);
695 nBasename = blob_size(&filename);
696 while( db_step(&q)==SQLITE_ROW ){
697 const char *zName = db_column_text(&q, 0);
@@ -1090,11 +1091,11 @@
1091 Blob unmodified;
1092 memset(&unmodified, 0, sizeof(Blob));
1093 blob_init(&unmodified, 0, 0);
1094 db_blob(&unmodified,
1095 "SELECT pathname FROM vfile"
1096 " WHERE chnged = 0 AND origname IS NULL AND is_selected(id)"
1097 );
1098 if( strlen(blob_str(&unmodified)) ){
1099 fossil_fatal("file %s has not changed", blob_str(&unmodified));
1100 }
1101 }
@@ -1151,11 +1152,11 @@
1152 ** table. If there were arguments passed to this command, only
1153 ** the identified fils are inserted (if they have been modified).
1154 */
1155 db_prepare(&q,
1156 "SELECT id, %Q || pathname, mrid, %s FROM vfile "
1157 "WHERE chnged==1 AND NOT deleted AND is_selected(id)",
1158 g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob",""))
1159 );
1160 while( db_step(&q)==SQLITE_ROW ){
1161 int id, rid;
1162 const char *zFullname;
@@ -1289,15 +1290,15 @@
1290 }
1291
1292
1293 /* Update the vfile and vmerge tables */
1294 db_multi_exec(
1295 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);"
1296 "DELETE FROM vmerge;"
1297 "UPDATE vfile SET vid=%d;"
1298 "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
1299 " WHERE is_selected(id);"
1300 , vid, nvid
1301 );
1302 db_lset_int("checkout", nvid);
1303
1304 if( useCksum ){
1305
+34 -14
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
13561356
if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
13571357
}
13581358
}
13591359
13601360
/*
1361
-** This is used by the [commit] command.
1362
-**
1363
-** Return true if either:
1364
-**
1365
-** a) Global.aCommitFile is NULL, or
1366
-** b) Global.aCommitFile contains the integer passed as an argument.
1367
-**
1368
-** Otherwise return false.
1361
+** SQL function:
1362
+**
1363
+** is_selected(id)
1364
+** if_selected(id, X, Y)
1365
+**
1366
+** On the commit command, when filenames are specified (in order to do
1367
+** a partial commit) the vfile.id values for the named files are loaded
1368
+** into the g.aCommitFile[] array. This function looks at that array
1369
+** to see if a file is named on the command-line.
1370
+**
1371
+** In the first form (1 argument) return TRUE if either no files are
1372
+** named on the command line (g.aCommitFile is NULL meaning that all
1373
+** changes are to be committed) or if id is found in g.aCommitFile[]
1374
+** (meaning that id was named on the command-line).
1375
+**
1376
+** In the second form (3 arguments) return argument X if true and Y
1377
+** if false.
13691378
*/
13701379
static void file_is_selected(
13711380
sqlite4_context *context,
13721381
int argc,
13731382
sqlite4_value **argv
13741383
){
1375
- assert(argc==1);
1384
+ int rc = 0;
1385
+
1386
+ assert(argc==1 || argc==3);
13761387
if( g.aCommitFile ){
13771388
int iId = sqlite4_value_int(argv[0]);
13781389
int ii;
13791390
for(ii=0; g.aCommitFile[ii]; ii++){
13801391
if( iId==g.aCommitFile[ii] ){
1381
- sqlite4_result_int(context, 1);
1382
- return;
1392
+ rc = 1;
1393
+ break;
13831394
}
13841395
}
1385
- sqlite4_result_int(context, 0);
1396
+ }else{
1397
+ rc = 1;
1398
+ }
1399
+ if( argc==1 ){
1400
+ sqlite4_result_int(context, rc);
13861401
}else{
1387
- sqlite4_result_int(context, 1);
1402
+ assert( argc==3 );
1403
+ assert( rc==0 || rc==1 );
1404
+ sqlite4_result_value(context, argv[2-rc]);
13881405
}
13891406
}
13901407
13911408
/*
13921409
** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
14551472
sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
14561473
sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
14571474
sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
14581475
sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
14591476
sqlite4_create_function(
1460
- g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1477
+ g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1478
+ );
1479
+ sqlite4_create_function(
1480
+ g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
14611481
);
14621482
if( g.fSqlTrace ){
14631483
sqlite4_trace(g.db, db_sql_trace, 0);
14641484
}
14651485
}
14661486
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
1356 if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
1357 }
1358 }
1359
1360 /*
1361 ** This is used by the [commit] command.
1362 **
1363 ** Return true if either:
1364 **
1365 ** a) Global.aCommitFile is NULL, or
1366 ** b) Global.aCommitFile contains the integer passed as an argument.
1367 **
1368 ** Otherwise return false.
 
 
 
 
 
 
 
 
 
1369 */
1370 static void file_is_selected(
1371 sqlite4_context *context,
1372 int argc,
1373 sqlite4_value **argv
1374 ){
1375 assert(argc==1);
 
 
1376 if( g.aCommitFile ){
1377 int iId = sqlite4_value_int(argv[0]);
1378 int ii;
1379 for(ii=0; g.aCommitFile[ii]; ii++){
1380 if( iId==g.aCommitFile[ii] ){
1381 sqlite4_result_int(context, 1);
1382 return;
1383 }
1384 }
1385 sqlite4_result_int(context, 0);
 
 
 
 
1386 }else{
1387 sqlite4_result_int(context, 1);
 
 
1388 }
1389 }
1390
1391 /*
1392 ** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
1455 sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
1456 sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1457 sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1458 sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
1459 sqlite4_create_function(
1460 g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
 
 
 
1461 );
1462 if( g.fSqlTrace ){
1463 sqlite4_trace(g.db, db_sql_trace, 0);
1464 }
1465 }
1466
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
1356 if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
1357 }
1358 }
1359
1360 /*
1361 ** SQL function:
1362 **
1363 ** is_selected(id)
1364 ** if_selected(id, X, Y)
1365 **
1366 ** On the commit command, when filenames are specified (in order to do
1367 ** a partial commit) the vfile.id values for the named files are loaded
1368 ** into the g.aCommitFile[] array. This function looks at that array
1369 ** to see if a file is named on the command-line.
1370 **
1371 ** In the first form (1 argument) return TRUE if either no files are
1372 ** named on the command line (g.aCommitFile is NULL meaning that all
1373 ** changes are to be committed) or if id is found in g.aCommitFile[]
1374 ** (meaning that id was named on the command-line).
1375 **
1376 ** In the second form (3 arguments) return argument X if true and Y
1377 ** if false.
1378 */
1379 static void file_is_selected(
1380 sqlite4_context *context,
1381 int argc,
1382 sqlite4_value **argv
1383 ){
1384 int rc = 0;
1385
1386 assert(argc==1 || argc==3);
1387 if( g.aCommitFile ){
1388 int iId = sqlite4_value_int(argv[0]);
1389 int ii;
1390 for(ii=0; g.aCommitFile[ii]; ii++){
1391 if( iId==g.aCommitFile[ii] ){
1392 rc = 1;
1393 break;
1394 }
1395 }
1396 }else{
1397 rc = 1;
1398 }
1399 if( argc==1 ){
1400 sqlite4_result_int(context, rc);
1401 }else{
1402 assert( argc==3 );
1403 assert( rc==0 || rc==1 );
1404 sqlite4_result_value(context, argv[2-rc]);
1405 }
1406 }
1407
1408 /*
1409 ** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
1472 sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
1473 sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1474 sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1475 sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
1476 sqlite4_create_function(
1477 g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1478 );
1479 sqlite4_create_function(
1480 g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
1481 );
1482 if( g.fSqlTrace ){
1483 sqlite4_trace(g.db, db_sql_trace, 0);
1484 }
1485 }
1486
+34 -14
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
13561356
if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
13571357
}
13581358
}
13591359
13601360
/*
1361
-** This is used by the [commit] command.
1362
-**
1363
-** Return true if either:
1364
-**
1365
-** a) Global.aCommitFile is NULL, or
1366
-** b) Global.aCommitFile contains the integer passed as an argument.
1367
-**
1368
-** Otherwise return false.
1361
+** SQL function:
1362
+**
1363
+** is_selected(id)
1364
+** if_selected(id, X, Y)
1365
+**
1366
+** On the commit command, when filenames are specified (in order to do
1367
+** a partial commit) the vfile.id values for the named files are loaded
1368
+** into the g.aCommitFile[] array. This function looks at that array
1369
+** to see if a file is named on the command-line.
1370
+**
1371
+** In the first form (1 argument) return TRUE if either no files are
1372
+** named on the command line (g.aCommitFile is NULL meaning that all
1373
+** changes are to be committed) or if id is found in g.aCommitFile[]
1374
+** (meaning that id was named on the command-line).
1375
+**
1376
+** In the second form (3 arguments) return argument X if true and Y
1377
+** if false.
13691378
*/
13701379
static void file_is_selected(
13711380
sqlite4_context *context,
13721381
int argc,
13731382
sqlite4_value **argv
13741383
){
1375
- assert(argc==1);
1384
+ int rc = 0;
1385
+
1386
+ assert(argc==1 || argc==3);
13761387
if( g.aCommitFile ){
13771388
int iId = sqlite4_value_int(argv[0]);
13781389
int ii;
13791390
for(ii=0; g.aCommitFile[ii]; ii++){
13801391
if( iId==g.aCommitFile[ii] ){
1381
- sqlite4_result_int(context, 1);
1382
- return;
1392
+ rc = 1;
1393
+ break;
13831394
}
13841395
}
1385
- sqlite4_result_int(context, 0);
1396
+ }else{
1397
+ rc = 1;
1398
+ }
1399
+ if( argc==1 ){
1400
+ sqlite4_result_int(context, rc);
13861401
}else{
1387
- sqlite4_result_int(context, 1);
1402
+ assert( argc==3 );
1403
+ assert( rc==0 || rc==1 );
1404
+ sqlite4_result_value(context, argv[2-rc]);
13881405
}
13891406
}
13901407
13911408
/*
13921409
** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
14551472
sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
14561473
sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
14571474
sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
14581475
sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
14591476
sqlite4_create_function(
1460
- g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1477
+ g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1478
+ );
1479
+ sqlite4_create_function(
1480
+ g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
14611481
);
14621482
if( g.fSqlTrace ){
14631483
sqlite4_trace(g.db, db_sql_trace, 0);
14641484
}
14651485
}
14661486
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
1356 if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
1357 }
1358 }
1359
1360 /*
1361 ** This is used by the [commit] command.
1362 **
1363 ** Return true if either:
1364 **
1365 ** a) Global.aCommitFile is NULL, or
1366 ** b) Global.aCommitFile contains the integer passed as an argument.
1367 **
1368 ** Otherwise return false.
 
 
 
 
 
 
 
 
 
1369 */
1370 static void file_is_selected(
1371 sqlite4_context *context,
1372 int argc,
1373 sqlite4_value **argv
1374 ){
1375 assert(argc==1);
 
 
1376 if( g.aCommitFile ){
1377 int iId = sqlite4_value_int(argv[0]);
1378 int ii;
1379 for(ii=0; g.aCommitFile[ii]; ii++){
1380 if( iId==g.aCommitFile[ii] ){
1381 sqlite4_result_int(context, 1);
1382 return;
1383 }
1384 }
1385 sqlite4_result_int(context, 0);
 
 
 
 
1386 }else{
1387 sqlite4_result_int(context, 1);
 
 
1388 }
1389 }
1390
1391 /*
1392 ** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
1455 sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
1456 sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1457 sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1458 sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
1459 sqlite4_create_function(
1460 g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
 
 
 
1461 );
1462 if( g.fSqlTrace ){
1463 sqlite4_trace(g.db, db_sql_trace, 0);
1464 }
1465 }
1466
--- src/db.c
+++ src/db.c
@@ -1356,37 +1356,54 @@
1356 if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT);
1357 }
1358 }
1359
1360 /*
1361 ** SQL function:
1362 **
1363 ** is_selected(id)
1364 ** if_selected(id, X, Y)
1365 **
1366 ** On the commit command, when filenames are specified (in order to do
1367 ** a partial commit) the vfile.id values for the named files are loaded
1368 ** into the g.aCommitFile[] array. This function looks at that array
1369 ** to see if a file is named on the command-line.
1370 **
1371 ** In the first form (1 argument) return TRUE if either no files are
1372 ** named on the command line (g.aCommitFile is NULL meaning that all
1373 ** changes are to be committed) or if id is found in g.aCommitFile[]
1374 ** (meaning that id was named on the command-line).
1375 **
1376 ** In the second form (3 arguments) return argument X if true and Y
1377 ** if false.
1378 */
1379 static void file_is_selected(
1380 sqlite4_context *context,
1381 int argc,
1382 sqlite4_value **argv
1383 ){
1384 int rc = 0;
1385
1386 assert(argc==1 || argc==3);
1387 if( g.aCommitFile ){
1388 int iId = sqlite4_value_int(argv[0]);
1389 int ii;
1390 for(ii=0; g.aCommitFile[ii]; ii++){
1391 if( iId==g.aCommitFile[ii] ){
1392 rc = 1;
1393 break;
1394 }
1395 }
1396 }else{
1397 rc = 1;
1398 }
1399 if( argc==1 ){
1400 sqlite4_result_int(context, rc);
1401 }else{
1402 assert( argc==3 );
1403 assert( rc==0 || rc==1 );
1404 sqlite4_result_value(context, argv[2-rc]);
1405 }
1406 }
1407
1408 /*
1409 ** Convert the input string into an SHA1. Make a notation in the
@@ -1455,11 +1472,14 @@
1472 sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0);
1473 sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1474 sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0);
1475 sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
1476 sqlite4_create_function(
1477 g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
1478 );
1479 sqlite4_create_function(
1480 g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0
1481 );
1482 if( g.fSqlTrace ){
1483 sqlite4_trace(g.db, db_sql_trace, 0);
1484 }
1485 }
1486
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974974
if( g.argc>3 ) n = atoi(g.argv[3]);
975975
for(i=0; i<n; i++){
976976
Blob b2;
977977
blob_copy(&b2, &b);
978978
p = manifest_parse(&b2, 0);
979
+ if( p==0 ) fossil_print("FAILED!\n");
979980
manifest_destroy(p);
980981
}
981982
}
982983
983984
/*
984985
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974 if( g.argc>3 ) n = atoi(g.argv[3]);
975 for(i=0; i<n; i++){
976 Blob b2;
977 blob_copy(&b2, &b);
978 p = manifest_parse(&b2, 0);
 
979 manifest_destroy(p);
980 }
981 }
982
983 /*
984
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974 if( g.argc>3 ) n = atoi(g.argv[3]);
975 for(i=0; i<n; i++){
976 Blob b2;
977 blob_copy(&b2, &b);
978 p = manifest_parse(&b2, 0);
979 if( p==0 ) fossil_print("FAILED!\n");
980 manifest_destroy(p);
981 }
982 }
983
984 /*
985
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974974
if( g.argc>3 ) n = atoi(g.argv[3]);
975975
for(i=0; i<n; i++){
976976
Blob b2;
977977
blob_copy(&b2, &b);
978978
p = manifest_parse(&b2, 0);
979
+ if( p==0 ) fossil_print("FAILED!\n");
979980
manifest_destroy(p);
980981
}
981982
}
982983
983984
/*
984985
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974 if( g.argc>3 ) n = atoi(g.argv[3]);
975 for(i=0; i<n; i++){
976 Blob b2;
977 blob_copy(&b2, &b);
978 p = manifest_parse(&b2, 0);
 
979 manifest_destroy(p);
980 }
981 }
982
983 /*
984
--- src/manifest.c
+++ src/manifest.c
@@ -974,10 +974,11 @@
974 if( g.argc>3 ) n = atoi(g.argv[3]);
975 for(i=0; i<n; i++){
976 Blob b2;
977 blob_copy(&b2, &b);
978 p = manifest_parse(&b2, 0);
979 if( p==0 ) fossil_print("FAILED!\n");
980 manifest_destroy(p);
981 }
982 }
983
984 /*
985
+8 -7
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474474
Stmt q;
475475
char zBuf[4096];
476476
477477
db_must_be_within_tree();
478478
db_prepare(&q,
479
- "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid"
479
+ "SELECT %Q || pathname, pathname, origname, is_selected(id), rid"
480480
" FROM vfile"
481
- " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d"
482
- " ORDER BY pathname /*scan*/",
481
+ " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d"
482
+ " ORDER BY if_selected(id, pathname, origname) /*scan*/",
483483
g.zLocalRoot, vid
484484
);
485485
md5sum_init();
486486
while( db_step(&q)==SQLITE_ROW ){
487487
const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566566
char *zOut;
567567
568568
db_must_be_within_tree();
569569
db_prepare(&q,
570570
"SELECT %Q || pathname, pathname, rid FROM vfile"
571
- " WHERE NOT deleted AND vid=%d AND file_is_selected(id)",
571
+ " WHERE NOT deleted AND vid=%d AND is_selected(id)"
572
+ " ORDER BY if_selected(id, pathname, origname) /*scan*/",
572573
g.zLocalRoot, vid
573574
);
574575
md5sum_init();
575576
while( db_step(&q)==SQLITE_ROW ){
576577
const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
628629
Stmt q;
629630
char zBuf[100];
630631
631632
db_must_be_within_tree();
632633
633
- db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)"
634
+ db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)"
634635
" FROM vfile"
635
- " WHERE (NOT deleted OR NOT file_is_selected(id))"
636
+ " WHERE (NOT deleted OR NOT is_selected(id))"
636637
" AND rid>0 AND vid=%d"
637
- " ORDER BY pathname /*scan*/",
638
+ " ORDER BY if_selected(id,pathname,origname) /*scan*/",
638639
vid);
639640
blob_zero(&file);
640641
md5sum_init();
641642
while( db_step(&q)==SQLITE_ROW ){
642643
const char *zName = db_column_text(&q, 0);
643644
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474 Stmt q;
475 char zBuf[4096];
476
477 db_must_be_within_tree();
478 db_prepare(&q,
479 "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid"
480 " FROM vfile"
481 " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d"
482 " ORDER BY pathname /*scan*/",
483 g.zLocalRoot, vid
484 );
485 md5sum_init();
486 while( db_step(&q)==SQLITE_ROW ){
487 const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566 char *zOut;
567
568 db_must_be_within_tree();
569 db_prepare(&q,
570 "SELECT %Q || pathname, pathname, rid FROM vfile"
571 " WHERE NOT deleted AND vid=%d AND file_is_selected(id)",
 
572 g.zLocalRoot, vid
573 );
574 md5sum_init();
575 while( db_step(&q)==SQLITE_ROW ){
576 const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
628 Stmt q;
629 char zBuf[100];
630
631 db_must_be_within_tree();
632
633 db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)"
634 " FROM vfile"
635 " WHERE (NOT deleted OR NOT file_is_selected(id))"
636 " AND rid>0 AND vid=%d"
637 " ORDER BY pathname /*scan*/",
638 vid);
639 blob_zero(&file);
640 md5sum_init();
641 while( db_step(&q)==SQLITE_ROW ){
642 const char *zName = db_column_text(&q, 0);
643
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474 Stmt q;
475 char zBuf[4096];
476
477 db_must_be_within_tree();
478 db_prepare(&q,
479 "SELECT %Q || pathname, pathname, origname, is_selected(id), rid"
480 " FROM vfile"
481 " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d"
482 " ORDER BY if_selected(id, pathname, origname) /*scan*/",
483 g.zLocalRoot, vid
484 );
485 md5sum_init();
486 while( db_step(&q)==SQLITE_ROW ){
487 const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566 char *zOut;
567
568 db_must_be_within_tree();
569 db_prepare(&q,
570 "SELECT %Q || pathname, pathname, rid FROM vfile"
571 " WHERE NOT deleted AND vid=%d AND is_selected(id)"
572 " ORDER BY if_selected(id, pathname, origname) /*scan*/",
573 g.zLocalRoot, vid
574 );
575 md5sum_init();
576 while( db_step(&q)==SQLITE_ROW ){
577 const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
629 Stmt q;
630 char zBuf[100];
631
632 db_must_be_within_tree();
633
634 db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)"
635 " FROM vfile"
636 " WHERE (NOT deleted OR NOT is_selected(id))"
637 " AND rid>0 AND vid=%d"
638 " ORDER BY if_selected(id,pathname,origname) /*scan*/",
639 vid);
640 blob_zero(&file);
641 md5sum_init();
642 while( db_step(&q)==SQLITE_ROW ){
643 const char *zName = db_column_text(&q, 0);
644
+8 -7
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474474
Stmt q;
475475
char zBuf[4096];
476476
477477
db_must_be_within_tree();
478478
db_prepare(&q,
479
- "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid"
479
+ "SELECT %Q || pathname, pathname, origname, is_selected(id), rid"
480480
" FROM vfile"
481
- " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d"
482
- " ORDER BY pathname /*scan*/",
481
+ " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d"
482
+ " ORDER BY if_selected(id, pathname, origname) /*scan*/",
483483
g.zLocalRoot, vid
484484
);
485485
md5sum_init();
486486
while( db_step(&q)==SQLITE_ROW ){
487487
const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566566
char *zOut;
567567
568568
db_must_be_within_tree();
569569
db_prepare(&q,
570570
"SELECT %Q || pathname, pathname, rid FROM vfile"
571
- " WHERE NOT deleted AND vid=%d AND file_is_selected(id)",
571
+ " WHERE NOT deleted AND vid=%d AND is_selected(id)"
572
+ " ORDER BY if_selected(id, pathname, origname) /*scan*/",
572573
g.zLocalRoot, vid
573574
);
574575
md5sum_init();
575576
while( db_step(&q)==SQLITE_ROW ){
576577
const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
628629
Stmt q;
629630
char zBuf[100];
630631
631632
db_must_be_within_tree();
632633
633
- db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)"
634
+ db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)"
634635
" FROM vfile"
635
- " WHERE (NOT deleted OR NOT file_is_selected(id))"
636
+ " WHERE (NOT deleted OR NOT is_selected(id))"
636637
" AND rid>0 AND vid=%d"
637
- " ORDER BY pathname /*scan*/",
638
+ " ORDER BY if_selected(id,pathname,origname) /*scan*/",
638639
vid);
639640
blob_zero(&file);
640641
md5sum_init();
641642
while( db_step(&q)==SQLITE_ROW ){
642643
const char *zName = db_column_text(&q, 0);
643644
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474 Stmt q;
475 char zBuf[4096];
476
477 db_must_be_within_tree();
478 db_prepare(&q,
479 "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid"
480 " FROM vfile"
481 " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d"
482 " ORDER BY pathname /*scan*/",
483 g.zLocalRoot, vid
484 );
485 md5sum_init();
486 while( db_step(&q)==SQLITE_ROW ){
487 const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566 char *zOut;
567
568 db_must_be_within_tree();
569 db_prepare(&q,
570 "SELECT %Q || pathname, pathname, rid FROM vfile"
571 " WHERE NOT deleted AND vid=%d AND file_is_selected(id)",
 
572 g.zLocalRoot, vid
573 );
574 md5sum_init();
575 while( db_step(&q)==SQLITE_ROW ){
576 const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
628 Stmt q;
629 char zBuf[100];
630
631 db_must_be_within_tree();
632
633 db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)"
634 " FROM vfile"
635 " WHERE (NOT deleted OR NOT file_is_selected(id))"
636 " AND rid>0 AND vid=%d"
637 " ORDER BY pathname /*scan*/",
638 vid);
639 blob_zero(&file);
640 md5sum_init();
641 while( db_step(&q)==SQLITE_ROW ){
642 const char *zName = db_column_text(&q, 0);
643
--- src/vfile.c
+++ src/vfile.c
@@ -474,14 +474,14 @@
474 Stmt q;
475 char zBuf[4096];
476
477 db_must_be_within_tree();
478 db_prepare(&q,
479 "SELECT %Q || pathname, pathname, origname, is_selected(id), rid"
480 " FROM vfile"
481 " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d"
482 " ORDER BY if_selected(id, pathname, origname) /*scan*/",
483 g.zLocalRoot, vid
484 );
485 md5sum_init();
486 while( db_step(&q)==SQLITE_ROW ){
487 const char *zFullpath = db_column_text(&q, 0);
@@ -566,11 +566,12 @@
566 char *zOut;
567
568 db_must_be_within_tree();
569 db_prepare(&q,
570 "SELECT %Q || pathname, pathname, rid FROM vfile"
571 " WHERE NOT deleted AND vid=%d AND is_selected(id)"
572 " ORDER BY if_selected(id, pathname, origname) /*scan*/",
573 g.zLocalRoot, vid
574 );
575 md5sum_init();
576 while( db_step(&q)==SQLITE_ROW ){
577 const char *zFullpath = db_column_text(&q, 0);
@@ -628,15 +629,15 @@
629 Stmt q;
630 char zBuf[100];
631
632 db_must_be_within_tree();
633
634 db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)"
635 " FROM vfile"
636 " WHERE (NOT deleted OR NOT is_selected(id))"
637 " AND rid>0 AND vid=%d"
638 " ORDER BY if_selected(id,pathname,origname) /*scan*/",
639 vid);
640 blob_zero(&file);
641 md5sum_init();
642 while( db_step(&q)==SQLITE_ROW ){
643 const char *zName = db_column_text(&q, 0);
644

Keyboard Shortcuts

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