Fossil SCM
Merge in the trunk changes.
Commit
0315f3f03bd9b6786550628e07e06b6b25736cc6
Parent
3f624d490b0696b…
7 files changed
+9
-8
+34
-14
+34
-14
+1
+1
+8
-7
+8
-7
+9
-8
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -42,11 +42,11 @@ | ||
| 42 | 42 | int nErr = 0; |
| 43 | 43 | Blob rewrittenPathname; |
| 44 | 44 | db_prepare(&q, |
| 45 | 45 | "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" |
| 46 | 46 | " FROM vfile " |
| 47 | - " WHERE file_is_selected(id)" | |
| 47 | + " WHERE is_selected(id)" | |
| 48 | 48 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 49 | 49 | ); |
| 50 | 50 | blob_zero(&rewrittenPathname); |
| 51 | 51 | while( db_step(&q)==SQLITE_ROW ){ |
| 52 | 52 | const char *zPathname = db_column_text(&q,0); |
| @@ -682,15 +682,16 @@ | ||
| 682 | 682 | zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); |
| 683 | 683 | blob_appendf(pOut, "D %s\n", zDate); |
| 684 | 684 | zDate[10] = ' '; |
| 685 | 685 | db_prepare(&q, |
| 686 | 686 | "SELECT pathname, uuid, origname, blob.rid, isexe, islink," |
| 687 | - " file_is_selected(vfile.id)" | |
| 687 | + " is_selected(vfile.id)" | |
| 688 | 688 | " 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))" | |
| 690 | 690 | " AND vfile.vid=%d" |
| 691 | - " ORDER BY 1", vid); | |
| 691 | + " ORDER BY if_selected(vfile.id, pathname, origname)", | |
| 692 | + vid); | |
| 692 | 693 | blob_zero(&filename); |
| 693 | 694 | blob_appendf(&filename, "%s", g.zLocalRoot); |
| 694 | 695 | nBasename = blob_size(&filename); |
| 695 | 696 | while( db_step(&q)==SQLITE_ROW ){ |
| 696 | 697 | const char *zName = db_column_text(&q, 0); |
| @@ -1090,11 +1091,11 @@ | ||
| 1090 | 1091 | Blob unmodified; |
| 1091 | 1092 | memset(&unmodified, 0, sizeof(Blob)); |
| 1092 | 1093 | blob_init(&unmodified, 0, 0); |
| 1093 | 1094 | db_blob(&unmodified, |
| 1094 | 1095 | "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)" | |
| 1096 | 1097 | ); |
| 1097 | 1098 | if( strlen(blob_str(&unmodified)) ){ |
| 1098 | 1099 | fossil_fatal("file %s has not changed", blob_str(&unmodified)); |
| 1099 | 1100 | } |
| 1100 | 1101 | } |
| @@ -1151,11 +1152,11 @@ | ||
| 1151 | 1152 | ** table. If there were arguments passed to this command, only |
| 1152 | 1153 | ** the identified fils are inserted (if they have been modified). |
| 1153 | 1154 | */ |
| 1154 | 1155 | db_prepare(&q, |
| 1155 | 1156 | "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)", | |
| 1157 | 1158 | g.zLocalRoot, glob_expr("pathname", db_get("crnl-glob","")) |
| 1158 | 1159 | ); |
| 1159 | 1160 | while( db_step(&q)==SQLITE_ROW ){ |
| 1160 | 1161 | int id, rid; |
| 1161 | 1162 | const char *zFullname; |
| @@ -1289,15 +1290,15 @@ | ||
| 1289 | 1290 | } |
| 1290 | 1291 | |
| 1291 | 1292 | |
| 1292 | 1293 | /* Update the vfile and vmerge tables */ |
| 1293 | 1294 | 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);" | |
| 1295 | 1296 | "DELETE FROM vmerge;" |
| 1296 | 1297 | "UPDATE vfile SET vid=%d;" |
| 1297 | 1298 | "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL" |
| 1298 | - " WHERE file_is_selected(id);" | |
| 1299 | + " WHERE is_selected(id);" | |
| 1299 | 1300 | , vid, nvid |
| 1300 | 1301 | ); |
| 1301 | 1302 | db_lset_int("checkout", nvid); |
| 1302 | 1303 | |
| 1303 | 1304 | if( useCksum ){ |
| 1304 | 1305 |
| --- 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 |
M
src/db.c
+34
-14
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1356,37 +1356,54 @@ | ||
| 1356 | 1356 | if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT); |
| 1357 | 1357 | } |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 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. | |
| 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. | |
| 1369 | 1378 | */ |
| 1370 | 1379 | static void file_is_selected( |
| 1371 | 1380 | sqlite4_context *context, |
| 1372 | 1381 | int argc, |
| 1373 | 1382 | sqlite4_value **argv |
| 1374 | 1383 | ){ |
| 1375 | - assert(argc==1); | |
| 1384 | + int rc = 0; | |
| 1385 | + | |
| 1386 | + assert(argc==1 || argc==3); | |
| 1376 | 1387 | if( g.aCommitFile ){ |
| 1377 | 1388 | int iId = sqlite4_value_int(argv[0]); |
| 1378 | 1389 | int ii; |
| 1379 | 1390 | for(ii=0; g.aCommitFile[ii]; ii++){ |
| 1380 | 1391 | if( iId==g.aCommitFile[ii] ){ |
| 1381 | - sqlite4_result_int(context, 1); | |
| 1382 | - return; | |
| 1392 | + rc = 1; | |
| 1393 | + break; | |
| 1383 | 1394 | } |
| 1384 | 1395 | } |
| 1385 | - sqlite4_result_int(context, 0); | |
| 1396 | + }else{ | |
| 1397 | + rc = 1; | |
| 1398 | + } | |
| 1399 | + if( argc==1 ){ | |
| 1400 | + sqlite4_result_int(context, rc); | |
| 1386 | 1401 | }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]); | |
| 1388 | 1405 | } |
| 1389 | 1406 | } |
| 1390 | 1407 | |
| 1391 | 1408 | /* |
| 1392 | 1409 | ** Convert the input string into an SHA1. Make a notation in the |
| @@ -1455,11 +1472,14 @@ | ||
| 1455 | 1472 | sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0); |
| 1456 | 1473 | sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1457 | 1474 | sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1458 | 1475 | sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0); |
| 1459 | 1476 | 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 | |
| 1461 | 1481 | ); |
| 1462 | 1482 | if( g.fSqlTrace ){ |
| 1463 | 1483 | sqlite4_trace(g.db, db_sql_trace, 0); |
| 1464 | 1484 | } |
| 1465 | 1485 | } |
| 1466 | 1486 |
| --- 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 |
M
src/db.c
+34
-14
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1356,37 +1356,54 @@ | ||
| 1356 | 1356 | if( zP ) sqlite4_result_text(context, zP, -1, SQLITE_TRANSIENT); |
| 1357 | 1357 | } |
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 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. | |
| 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. | |
| 1369 | 1378 | */ |
| 1370 | 1379 | static void file_is_selected( |
| 1371 | 1380 | sqlite4_context *context, |
| 1372 | 1381 | int argc, |
| 1373 | 1382 | sqlite4_value **argv |
| 1374 | 1383 | ){ |
| 1375 | - assert(argc==1); | |
| 1384 | + int rc = 0; | |
| 1385 | + | |
| 1386 | + assert(argc==1 || argc==3); | |
| 1376 | 1387 | if( g.aCommitFile ){ |
| 1377 | 1388 | int iId = sqlite4_value_int(argv[0]); |
| 1378 | 1389 | int ii; |
| 1379 | 1390 | for(ii=0; g.aCommitFile[ii]; ii++){ |
| 1380 | 1391 | if( iId==g.aCommitFile[ii] ){ |
| 1381 | - sqlite4_result_int(context, 1); | |
| 1382 | - return; | |
| 1392 | + rc = 1; | |
| 1393 | + break; | |
| 1383 | 1394 | } |
| 1384 | 1395 | } |
| 1385 | - sqlite4_result_int(context, 0); | |
| 1396 | + }else{ | |
| 1397 | + rc = 1; | |
| 1398 | + } | |
| 1399 | + if( argc==1 ){ | |
| 1400 | + sqlite4_result_int(context, rc); | |
| 1386 | 1401 | }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]); | |
| 1388 | 1405 | } |
| 1389 | 1406 | } |
| 1390 | 1407 | |
| 1391 | 1408 | /* |
| 1392 | 1409 | ** Convert the input string into an SHA1. Make a notation in the |
| @@ -1455,11 +1472,14 @@ | ||
| 1455 | 1472 | sqlite4_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0); |
| 1456 | 1473 | sqlite4_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1457 | 1474 | sqlite4_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1458 | 1475 | sqlite4_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0); |
| 1459 | 1476 | 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 | |
| 1461 | 1481 | ); |
| 1462 | 1482 | if( g.fSqlTrace ){ |
| 1463 | 1483 | sqlite4_trace(g.db, db_sql_trace, 0); |
| 1464 | 1484 | } |
| 1465 | 1485 | } |
| 1466 | 1486 |
| --- 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 |
+1
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -974,10 +974,11 @@ | ||
| 974 | 974 | if( g.argc>3 ) n = atoi(g.argv[3]); |
| 975 | 975 | for(i=0; i<n; i++){ |
| 976 | 976 | Blob b2; |
| 977 | 977 | blob_copy(&b2, &b); |
| 978 | 978 | p = manifest_parse(&b2, 0); |
| 979 | + if( p==0 ) fossil_print("FAILED!\n"); | |
| 979 | 980 | manifest_destroy(p); |
| 980 | 981 | } |
| 981 | 982 | } |
| 982 | 983 | |
| 983 | 984 | /* |
| 984 | 985 |
| --- 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 |
+1
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -974,10 +974,11 @@ | ||
| 974 | 974 | if( g.argc>3 ) n = atoi(g.argv[3]); |
| 975 | 975 | for(i=0; i<n; i++){ |
| 976 | 976 | Blob b2; |
| 977 | 977 | blob_copy(&b2, &b); |
| 978 | 978 | p = manifest_parse(&b2, 0); |
| 979 | + if( p==0 ) fossil_print("FAILED!\n"); | |
| 979 | 980 | manifest_destroy(p); |
| 980 | 981 | } |
| 981 | 982 | } |
| 982 | 983 | |
| 983 | 984 | /* |
| 984 | 985 |
| --- 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 @@ | ||
| 474 | 474 | Stmt q; |
| 475 | 475 | char zBuf[4096]; |
| 476 | 476 | |
| 477 | 477 | db_must_be_within_tree(); |
| 478 | 478 | db_prepare(&q, |
| 479 | - "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid" | |
| 479 | + "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" | |
| 480 | 480 | " 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*/", | |
| 483 | 483 | g.zLocalRoot, vid |
| 484 | 484 | ); |
| 485 | 485 | md5sum_init(); |
| 486 | 486 | while( db_step(&q)==SQLITE_ROW ){ |
| 487 | 487 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -566,11 +566,12 @@ | ||
| 566 | 566 | char *zOut; |
| 567 | 567 | |
| 568 | 568 | db_must_be_within_tree(); |
| 569 | 569 | db_prepare(&q, |
| 570 | 570 | "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*/", | |
| 572 | 573 | g.zLocalRoot, vid |
| 573 | 574 | ); |
| 574 | 575 | md5sum_init(); |
| 575 | 576 | while( db_step(&q)==SQLITE_ROW ){ |
| 576 | 577 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -628,15 +629,15 @@ | ||
| 628 | 629 | Stmt q; |
| 629 | 630 | char zBuf[100]; |
| 630 | 631 | |
| 631 | 632 | db_must_be_within_tree(); |
| 632 | 633 | |
| 633 | - db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)" | |
| 634 | + db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" | |
| 634 | 635 | " FROM vfile" |
| 635 | - " WHERE (NOT deleted OR NOT file_is_selected(id))" | |
| 636 | + " WHERE (NOT deleted OR NOT is_selected(id))" | |
| 636 | 637 | " AND rid>0 AND vid=%d" |
| 637 | - " ORDER BY pathname /*scan*/", | |
| 638 | + " ORDER BY if_selected(id,pathname,origname) /*scan*/", | |
| 638 | 639 | vid); |
| 639 | 640 | blob_zero(&file); |
| 640 | 641 | md5sum_init(); |
| 641 | 642 | while( db_step(&q)==SQLITE_ROW ){ |
| 642 | 643 | const char *zName = db_column_text(&q, 0); |
| 643 | 644 |
| --- 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 @@ | ||
| 474 | 474 | Stmt q; |
| 475 | 475 | char zBuf[4096]; |
| 476 | 476 | |
| 477 | 477 | db_must_be_within_tree(); |
| 478 | 478 | db_prepare(&q, |
| 479 | - "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid" | |
| 479 | + "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" | |
| 480 | 480 | " 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*/", | |
| 483 | 483 | g.zLocalRoot, vid |
| 484 | 484 | ); |
| 485 | 485 | md5sum_init(); |
| 486 | 486 | while( db_step(&q)==SQLITE_ROW ){ |
| 487 | 487 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -566,11 +566,12 @@ | ||
| 566 | 566 | char *zOut; |
| 567 | 567 | |
| 568 | 568 | db_must_be_within_tree(); |
| 569 | 569 | db_prepare(&q, |
| 570 | 570 | "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*/", | |
| 572 | 573 | g.zLocalRoot, vid |
| 573 | 574 | ); |
| 574 | 575 | md5sum_init(); |
| 575 | 576 | while( db_step(&q)==SQLITE_ROW ){ |
| 576 | 577 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -628,15 +629,15 @@ | ||
| 628 | 629 | Stmt q; |
| 629 | 630 | char zBuf[100]; |
| 630 | 631 | |
| 631 | 632 | db_must_be_within_tree(); |
| 632 | 633 | |
| 633 | - db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)" | |
| 634 | + db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" | |
| 634 | 635 | " FROM vfile" |
| 635 | - " WHERE (NOT deleted OR NOT file_is_selected(id))" | |
| 636 | + " WHERE (NOT deleted OR NOT is_selected(id))" | |
| 636 | 637 | " AND rid>0 AND vid=%d" |
| 637 | - " ORDER BY pathname /*scan*/", | |
| 638 | + " ORDER BY if_selected(id,pathname,origname) /*scan*/", | |
| 638 | 639 | vid); |
| 639 | 640 | blob_zero(&file); |
| 640 | 641 | md5sum_init(); |
| 641 | 642 | while( db_step(&q)==SQLITE_ROW ){ |
| 642 | 643 | const char *zName = db_column_text(&q, 0); |
| 643 | 644 |
| --- 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 |