Fossil SCM
Fix the manifest generator for check-ins so that when a partial commit is done and some of the uncommitted files have been renamed, the rows of the check-in manifest are ordered by the original, unchanged names of the uncommitted renamed files.
Commit
01e4de6b8ae936b551bd215cce1e5a0826fe4a56
Parent
4113f5881bba989…
3 files changed
+9
-8
+34
-14
+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 | ||
| @@ -1362,37 +1362,54 @@ | ||
| 1362 | 1362 | if( zP ) sqlite3_result_text(context, zP, -1, SQLITE_TRANSIENT); |
| 1363 | 1363 | } |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | /* |
| 1367 | -** This is used by the [commit] command. | |
| 1368 | -** | |
| 1369 | -** Return true if either: | |
| 1370 | -** | |
| 1371 | -** a) Global.aCommitFile is NULL, or | |
| 1372 | -** b) Global.aCommitFile contains the integer passed as an argument. | |
| 1373 | -** | |
| 1374 | -** Otherwise return false. | |
| 1367 | +** SQL function: | |
| 1368 | +** | |
| 1369 | +** is_selected(id) | |
| 1370 | +** if_selected(id, X, Y) | |
| 1371 | +** | |
| 1372 | +** On the commit command, when filenames are specified (in order to do | |
| 1373 | +** a partial commit) the vfile.id values for the named files are loaded | |
| 1374 | +** into the g.aCommitFile[] array. This function looks at that array | |
| 1375 | +** to see if a file is named on the command-line. | |
| 1376 | +** | |
| 1377 | +** In the first form (1 argument) return TRUE if either no files are | |
| 1378 | +** named on the command line (g.aCommitFile is NULL meaning that all | |
| 1379 | +** changes are to be committed) or if id is found in g.aCommitFile[] | |
| 1380 | +** (meaning that id was named on the command-line). | |
| 1381 | +** | |
| 1382 | +** In the second form (3 arguments) return argument X if true and Y | |
| 1383 | +** if false. | |
| 1375 | 1384 | */ |
| 1376 | 1385 | static void file_is_selected( |
| 1377 | 1386 | sqlite3_context *context, |
| 1378 | 1387 | int argc, |
| 1379 | 1388 | sqlite3_value **argv |
| 1380 | 1389 | ){ |
| 1381 | - assert(argc==1); | |
| 1390 | + int rc = 0; | |
| 1391 | + | |
| 1392 | + assert(argc==1 || argc==3); | |
| 1382 | 1393 | if( g.aCommitFile ){ |
| 1383 | 1394 | int iId = sqlite3_value_int(argv[0]); |
| 1384 | 1395 | int ii; |
| 1385 | 1396 | for(ii=0; g.aCommitFile[ii]; ii++){ |
| 1386 | 1397 | if( iId==g.aCommitFile[ii] ){ |
| 1387 | - sqlite3_result_int(context, 1); | |
| 1388 | - return; | |
| 1398 | + rc = 1; | |
| 1399 | + break; | |
| 1389 | 1400 | } |
| 1390 | 1401 | } |
| 1391 | - sqlite3_result_int(context, 0); | |
| 1402 | + }else{ | |
| 1403 | + rc = 1; | |
| 1404 | + } | |
| 1405 | + if( argc==1 ){ | |
| 1406 | + sqlite3_result_int(context, rc); | |
| 1392 | 1407 | }else{ |
| 1393 | - sqlite3_result_int(context, 1); | |
| 1408 | + assert( argc==3 ); | |
| 1409 | + assert( rc==0 || rc==1 ); | |
| 1410 | + sqlite3_result_value(context, argv[2-rc]); | |
| 1394 | 1411 | } |
| 1395 | 1412 | } |
| 1396 | 1413 | |
| 1397 | 1414 | /* |
| 1398 | 1415 | ** Convert the input string into an SHA1. Make a notation in the |
| @@ -1461,11 +1478,14 @@ | ||
| 1461 | 1478 | sqlite3_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0); |
| 1462 | 1479 | sqlite3_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1463 | 1480 | sqlite3_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1464 | 1481 | sqlite3_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0); |
| 1465 | 1482 | sqlite3_create_function( |
| 1466 | - g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0 | |
| 1483 | + g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0 | |
| 1484 | + ); | |
| 1485 | + sqlite3_create_function( | |
| 1486 | + g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0 | |
| 1467 | 1487 | ); |
| 1468 | 1488 | if( g.fSqlTrace ){ |
| 1469 | 1489 | sqlite3_trace(g.db, db_sql_trace, 0); |
| 1470 | 1490 | } |
| 1471 | 1491 | } |
| 1472 | 1492 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1362,37 +1362,54 @@ | |
| 1362 | if( zP ) sqlite3_result_text(context, zP, -1, SQLITE_TRANSIENT); |
| 1363 | } |
| 1364 | } |
| 1365 | |
| 1366 | /* |
| 1367 | ** This is used by the [commit] command. |
| 1368 | ** |
| 1369 | ** Return true if either: |
| 1370 | ** |
| 1371 | ** a) Global.aCommitFile is NULL, or |
| 1372 | ** b) Global.aCommitFile contains the integer passed as an argument. |
| 1373 | ** |
| 1374 | ** Otherwise return false. |
| 1375 | */ |
| 1376 | static void file_is_selected( |
| 1377 | sqlite3_context *context, |
| 1378 | int argc, |
| 1379 | sqlite3_value **argv |
| 1380 | ){ |
| 1381 | assert(argc==1); |
| 1382 | if( g.aCommitFile ){ |
| 1383 | int iId = sqlite3_value_int(argv[0]); |
| 1384 | int ii; |
| 1385 | for(ii=0; g.aCommitFile[ii]; ii++){ |
| 1386 | if( iId==g.aCommitFile[ii] ){ |
| 1387 | sqlite3_result_int(context, 1); |
| 1388 | return; |
| 1389 | } |
| 1390 | } |
| 1391 | sqlite3_result_int(context, 0); |
| 1392 | }else{ |
| 1393 | sqlite3_result_int(context, 1); |
| 1394 | } |
| 1395 | } |
| 1396 | |
| 1397 | /* |
| 1398 | ** Convert the input string into an SHA1. Make a notation in the |
| @@ -1461,11 +1478,14 @@ | |
| 1461 | sqlite3_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0); |
| 1462 | sqlite3_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1463 | sqlite3_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1464 | sqlite3_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0); |
| 1465 | sqlite3_create_function( |
| 1466 | g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0 |
| 1467 | ); |
| 1468 | if( g.fSqlTrace ){ |
| 1469 | sqlite3_trace(g.db, db_sql_trace, 0); |
| 1470 | } |
| 1471 | } |
| 1472 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1362,37 +1362,54 @@ | |
| 1362 | if( zP ) sqlite3_result_text(context, zP, -1, SQLITE_TRANSIENT); |
| 1363 | } |
| 1364 | } |
| 1365 | |
| 1366 | /* |
| 1367 | ** SQL function: |
| 1368 | ** |
| 1369 | ** is_selected(id) |
| 1370 | ** if_selected(id, X, Y) |
| 1371 | ** |
| 1372 | ** On the commit command, when filenames are specified (in order to do |
| 1373 | ** a partial commit) the vfile.id values for the named files are loaded |
| 1374 | ** into the g.aCommitFile[] array. This function looks at that array |
| 1375 | ** to see if a file is named on the command-line. |
| 1376 | ** |
| 1377 | ** In the first form (1 argument) return TRUE if either no files are |
| 1378 | ** named on the command line (g.aCommitFile is NULL meaning that all |
| 1379 | ** changes are to be committed) or if id is found in g.aCommitFile[] |
| 1380 | ** (meaning that id was named on the command-line). |
| 1381 | ** |
| 1382 | ** In the second form (3 arguments) return argument X if true and Y |
| 1383 | ** if false. |
| 1384 | */ |
| 1385 | static void file_is_selected( |
| 1386 | sqlite3_context *context, |
| 1387 | int argc, |
| 1388 | sqlite3_value **argv |
| 1389 | ){ |
| 1390 | int rc = 0; |
| 1391 | |
| 1392 | assert(argc==1 || argc==3); |
| 1393 | if( g.aCommitFile ){ |
| 1394 | int iId = sqlite3_value_int(argv[0]); |
| 1395 | int ii; |
| 1396 | for(ii=0; g.aCommitFile[ii]; ii++){ |
| 1397 | if( iId==g.aCommitFile[ii] ){ |
| 1398 | rc = 1; |
| 1399 | break; |
| 1400 | } |
| 1401 | } |
| 1402 | }else{ |
| 1403 | rc = 1; |
| 1404 | } |
| 1405 | if( argc==1 ){ |
| 1406 | sqlite3_result_int(context, rc); |
| 1407 | }else{ |
| 1408 | assert( argc==3 ); |
| 1409 | assert( rc==0 || rc==1 ); |
| 1410 | sqlite3_result_value(context, argv[2-rc]); |
| 1411 | } |
| 1412 | } |
| 1413 | |
| 1414 | /* |
| 1415 | ** Convert the input string into an SHA1. Make a notation in the |
| @@ -1461,11 +1478,14 @@ | |
| 1478 | sqlite3_create_function(g.db, "user", 0, SQLITE_ANY, 0, db_sql_user, 0, 0); |
| 1479 | sqlite3_create_function(g.db, "cgi", 1, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1480 | sqlite3_create_function(g.db, "cgi", 2, SQLITE_ANY, 0, db_sql_cgi, 0, 0); |
| 1481 | sqlite3_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0); |
| 1482 | sqlite3_create_function( |
| 1483 | g.db, "is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0 |
| 1484 | ); |
| 1485 | sqlite3_create_function( |
| 1486 | g.db, "if_selected", 3, SQLITE_UTF8, 0, file_is_selected,0,0 |
| 1487 | ); |
| 1488 | if( g.fSqlTrace ){ |
| 1489 | sqlite3_trace(g.db, db_sql_trace, 0); |
| 1490 | } |
| 1491 | } |
| 1492 |
+8
-7
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -473,14 +473,14 @@ | ||
| 473 | 473 | Stmt q; |
| 474 | 474 | char zBuf[4096]; |
| 475 | 475 | |
| 476 | 476 | db_must_be_within_tree(); |
| 477 | 477 | db_prepare(&q, |
| 478 | - "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid" | |
| 478 | + "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" | |
| 479 | 479 | " FROM vfile" |
| 480 | - " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d" | |
| 481 | - " ORDER BY pathname /*scan*/", | |
| 480 | + " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d" | |
| 481 | + " ORDER BY if_selected(id, pathname, origname) /*scan*/", | |
| 482 | 482 | g.zLocalRoot, vid |
| 483 | 483 | ); |
| 484 | 484 | md5sum_init(); |
| 485 | 485 | while( db_step(&q)==SQLITE_ROW ){ |
| 486 | 486 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -565,11 +565,12 @@ | ||
| 565 | 565 | char *zOut; |
| 566 | 566 | |
| 567 | 567 | db_must_be_within_tree(); |
| 568 | 568 | db_prepare(&q, |
| 569 | 569 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 570 | - " WHERE NOT deleted AND vid=%d AND file_is_selected(id)", | |
| 570 | + " WHERE NOT deleted AND vid=%d AND is_selected(id)" | |
| 571 | + " ORDER BY if_selected(id, pathname, origname) /*scan*/", | |
| 571 | 572 | g.zLocalRoot, vid |
| 572 | 573 | ); |
| 573 | 574 | md5sum_init(); |
| 574 | 575 | while( db_step(&q)==SQLITE_ROW ){ |
| 575 | 576 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -627,15 +628,15 @@ | ||
| 627 | 628 | Stmt q; |
| 628 | 629 | char zBuf[100]; |
| 629 | 630 | |
| 630 | 631 | db_must_be_within_tree(); |
| 631 | 632 | |
| 632 | - db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)" | |
| 633 | + db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" | |
| 633 | 634 | " FROM vfile" |
| 634 | - " WHERE (NOT deleted OR NOT file_is_selected(id))" | |
| 635 | + " WHERE (NOT deleted OR NOT is_selected(id))" | |
| 635 | 636 | " AND rid>0 AND vid=%d" |
| 636 | - " ORDER BY pathname /*scan*/", | |
| 637 | + " ORDER BY if_selected(id,pathname,origname) /*scan*/", | |
| 637 | 638 | vid); |
| 638 | 639 | blob_zero(&file); |
| 639 | 640 | md5sum_init(); |
| 640 | 641 | while( db_step(&q)==SQLITE_ROW ){ |
| 641 | 642 | const char *zName = db_column_text(&q, 0); |
| 642 | 643 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -473,14 +473,14 @@ | |
| 473 | Stmt q; |
| 474 | char zBuf[4096]; |
| 475 | |
| 476 | db_must_be_within_tree(); |
| 477 | db_prepare(&q, |
| 478 | "SELECT %Q || pathname, pathname, origname, file_is_selected(id), rid" |
| 479 | " FROM vfile" |
| 480 | " WHERE (NOT deleted OR NOT file_is_selected(id)) AND vid=%d" |
| 481 | " ORDER BY pathname /*scan*/", |
| 482 | g.zLocalRoot, vid |
| 483 | ); |
| 484 | md5sum_init(); |
| 485 | while( db_step(&q)==SQLITE_ROW ){ |
| 486 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -565,11 +565,12 @@ | |
| 565 | char *zOut; |
| 566 | |
| 567 | db_must_be_within_tree(); |
| 568 | db_prepare(&q, |
| 569 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 570 | " WHERE NOT deleted AND vid=%d AND file_is_selected(id)", |
| 571 | g.zLocalRoot, vid |
| 572 | ); |
| 573 | md5sum_init(); |
| 574 | while( db_step(&q)==SQLITE_ROW ){ |
| 575 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -627,15 +628,15 @@ | |
| 627 | Stmt q; |
| 628 | char zBuf[100]; |
| 629 | |
| 630 | db_must_be_within_tree(); |
| 631 | |
| 632 | db_prepare(&q, "SELECT pathname, origname, rid, file_is_selected(id)" |
| 633 | " FROM vfile" |
| 634 | " WHERE (NOT deleted OR NOT file_is_selected(id))" |
| 635 | " AND rid>0 AND vid=%d" |
| 636 | " ORDER BY pathname /*scan*/", |
| 637 | vid); |
| 638 | blob_zero(&file); |
| 639 | md5sum_init(); |
| 640 | while( db_step(&q)==SQLITE_ROW ){ |
| 641 | const char *zName = db_column_text(&q, 0); |
| 642 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -473,14 +473,14 @@ | |
| 473 | Stmt q; |
| 474 | char zBuf[4096]; |
| 475 | |
| 476 | db_must_be_within_tree(); |
| 477 | db_prepare(&q, |
| 478 | "SELECT %Q || pathname, pathname, origname, is_selected(id), rid" |
| 479 | " FROM vfile" |
| 480 | " WHERE (NOT deleted OR NOT is_selected(id)) AND vid=%d" |
| 481 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 482 | g.zLocalRoot, vid |
| 483 | ); |
| 484 | md5sum_init(); |
| 485 | while( db_step(&q)==SQLITE_ROW ){ |
| 486 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -565,11 +565,12 @@ | |
| 565 | char *zOut; |
| 566 | |
| 567 | db_must_be_within_tree(); |
| 568 | db_prepare(&q, |
| 569 | "SELECT %Q || pathname, pathname, rid FROM vfile" |
| 570 | " WHERE NOT deleted AND vid=%d AND is_selected(id)" |
| 571 | " ORDER BY if_selected(id, pathname, origname) /*scan*/", |
| 572 | g.zLocalRoot, vid |
| 573 | ); |
| 574 | md5sum_init(); |
| 575 | while( db_step(&q)==SQLITE_ROW ){ |
| 576 | const char *zFullpath = db_column_text(&q, 0); |
| @@ -627,15 +628,15 @@ | |
| 628 | Stmt q; |
| 629 | char zBuf[100]; |
| 630 | |
| 631 | db_must_be_within_tree(); |
| 632 | |
| 633 | db_prepare(&q, "SELECT pathname, origname, rid, is_selected(id)" |
| 634 | " FROM vfile" |
| 635 | " WHERE (NOT deleted OR NOT is_selected(id))" |
| 636 | " AND rid>0 AND vid=%d" |
| 637 | " ORDER BY if_selected(id,pathname,origname) /*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 |