Fossil SCM
Speedup "fossil extras" and other commands which traverse the local filesystem. See: [http://www.mail-archive.com/[email protected]/msg14697.html]. Thanks to Samuel Debionne for the suggestion.
Commit
3fbdaa243d1832cedb542f68ec2e7558c281a484
Parent
bd0b09e50b80461…
2 files changed
+7
-1
+20
+7
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -858,11 +858,17 @@ | ||
| 858 | 858 | continue; |
| 859 | 859 | } |
| 860 | 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | 862 | fossil_filename_free(zUtf8Name); |
| 863 | - if( file_isdir(zSubpath)==1 ){ | |
| 863 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 864 | + if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 865 | + ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) | |
| 866 | +#else | |
| 867 | + if( file_isdir(zSubpath)==1 ) | |
| 868 | +#endif | |
| 869 | + { | |
| 864 | 870 | recon_read_dir(zSubpath); |
| 865 | 871 | }else{ |
| 866 | 872 | blob_init(&path, 0, 0); |
| 867 | 873 | blob_appendf(&path, "%s", zSubpath); |
| 868 | 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 869 | 875 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -858,11 +858,17 @@ | |
| 858 | continue; |
| 859 | } |
| 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | fossil_filename_free(zUtf8Name); |
| 863 | if( file_isdir(zSubpath)==1 ){ |
| 864 | recon_read_dir(zSubpath); |
| 865 | }else{ |
| 866 | blob_init(&path, 0, 0); |
| 867 | blob_appendf(&path, "%s", zSubpath); |
| 868 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 869 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -858,11 +858,17 @@ | |
| 858 | continue; |
| 859 | } |
| 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | fossil_filename_free(zUtf8Name); |
| 863 | #ifdef _DIRENT_HAVE_D_TYPE |
| 864 | if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 865 | ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) |
| 866 | #else |
| 867 | if( file_isdir(zSubpath)==1 ) |
| 868 | #endif |
| 869 | { |
| 870 | recon_read_dir(zSubpath); |
| 871 | }else{ |
| 872 | blob_init(&path, 0, 0); |
| 873 | blob_appendf(&path, "%s", zSubpath); |
| 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 875 |
+20
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -486,15 +486,25 @@ | ||
| 486 | 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | 487 | zPath = blob_str(pPath); |
| 488 | 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | 490 | /* do nothing */ |
| 491 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 492 | + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 493 | + ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ | |
| 494 | +#else | |
| 491 | 495 | }else if( file_wd_isdir(zPath)==1 ){ |
| 496 | +#endif | |
| 492 | 497 | if( !vfile_top_of_checkout(zPath) ){ |
| 493 | 498 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 494 | 499 | } |
| 500 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 501 | + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 502 | + ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ | |
| 503 | +#else | |
| 495 | 504 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 505 | +#endif | |
| 496 | 506 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 497 | 507 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 498 | 508 | db_step(&ins); |
| 499 | 509 | db_reset(&ins); |
| 500 | 510 | } |
| @@ -593,11 +603,16 @@ | ||
| 593 | 603 | zPath = blob_str(pPath); |
| 594 | 604 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 595 | 605 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 596 | 606 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 597 | 607 | /* do nothing */ |
| 608 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 609 | + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 610 | + ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ | |
| 611 | +#else | |
| 598 | 612 | }else if( file_wd_isdir(zPath)==1 ){ |
| 613 | +#endif | |
| 599 | 614 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 600 | 615 | char *zSavePath = mprintf("%s", zPath); |
| 601 | 616 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 602 | 617 | pIgnore2, pIgnore3); |
| 603 | 618 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | ||
| 605 | 620 | db_step(&ins); |
| 606 | 621 | db_reset(&ins); |
| 607 | 622 | fossil_free(zSavePath); |
| 608 | 623 | result += count; /* found X normal files? */ |
| 609 | 624 | } |
| 625 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 626 | + }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 627 | + ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ | |
| 628 | +#else | |
| 610 | 629 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 630 | +#endif | |
| 611 | 631 | db_bind_text(&upd, ":file", zOrigPath); |
| 612 | 632 | db_step(&upd); |
| 613 | 633 | db_reset(&upd); |
| 614 | 634 | result++; /* found 1 normal file */ |
| 615 | 635 | } |
| 616 | 636 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -486,15 +486,25 @@ | |
| 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | zPath = blob_str(pPath); |
| 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | /* do nothing */ |
| 491 | }else if( file_wd_isdir(zPath)==1 ){ |
| 492 | if( !vfile_top_of_checkout(zPath) ){ |
| 493 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 494 | } |
| 495 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 496 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 497 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 498 | db_step(&ins); |
| 499 | db_reset(&ins); |
| 500 | } |
| @@ -593,11 +603,16 @@ | |
| 593 | zPath = blob_str(pPath); |
| 594 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 595 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 596 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 597 | /* do nothing */ |
| 598 | }else if( file_wd_isdir(zPath)==1 ){ |
| 599 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 600 | char *zSavePath = mprintf("%s", zPath); |
| 601 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 602 | pIgnore2, pIgnore3); |
| 603 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | |
| 605 | db_step(&ins); |
| 606 | db_reset(&ins); |
| 607 | fossil_free(zSavePath); |
| 608 | result += count; /* found X normal files? */ |
| 609 | } |
| 610 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 611 | db_bind_text(&upd, ":file", zOrigPath); |
| 612 | db_step(&upd); |
| 613 | db_reset(&upd); |
| 614 | result++; /* found 1 normal file */ |
| 615 | } |
| 616 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -486,15 +486,25 @@ | |
| 486 | blob_appendf(pPath, "/%s", zUtf8); |
| 487 | zPath = blob_str(pPath); |
| 488 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 489 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| 490 | /* do nothing */ |
| 491 | #ifdef _DIRENT_HAVE_D_TYPE |
| 492 | }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 493 | ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ |
| 494 | #else |
| 495 | }else if( file_wd_isdir(zPath)==1 ){ |
| 496 | #endif |
| 497 | if( !vfile_top_of_checkout(zPath) ){ |
| 498 | vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2); |
| 499 | } |
| 500 | #ifdef _DIRENT_HAVE_D_TYPE |
| 501 | }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 502 | ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ |
| 503 | #else |
| 504 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 505 | #endif |
| 506 | if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ |
| 507 | db_bind_text(&ins, ":file", &zPath[nPrefix+1]); |
| 508 | db_step(&ins); |
| 509 | db_reset(&ins); |
| 510 | } |
| @@ -593,11 +603,16 @@ | |
| 603 | zPath = blob_str(pPath); |
| 604 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 605 | glob_match(pIgnore2, &zPath[nPrefix+1]) || |
| 606 | glob_match(pIgnore3, &zPath[nPrefix+1]) ){ |
| 607 | /* do nothing */ |
| 608 | #ifdef _DIRENT_HAVE_D_TYPE |
| 609 | }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 610 | ? (file_wd_isdir(zPath)==1) : (pEntry->d_type==DT_DIR) ){ |
| 611 | #else |
| 612 | }else if( file_wd_isdir(zPath)==1 ){ |
| 613 | #endif |
| 614 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 615 | char *zSavePath = mprintf("%s", zPath); |
| 616 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 617 | pIgnore2, pIgnore3); |
| 618 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| @@ -605,11 +620,16 @@ | |
| 620 | db_step(&ins); |
| 621 | db_reset(&ins); |
| 622 | fossil_free(zSavePath); |
| 623 | result += count; /* found X normal files? */ |
| 624 | } |
| 625 | #ifdef _DIRENT_HAVE_D_TYPE |
| 626 | }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 627 | ? (file_wd_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ |
| 628 | #else |
| 629 | }else if( file_wd_isfile_or_link(zPath) ){ |
| 630 | #endif |
| 631 | db_bind_text(&upd, ":file", zOrigPath); |
| 632 | db_step(&upd); |
| 633 | db_reset(&upd); |
| 634 | result++; /* found 1 normal file */ |
| 635 | } |
| 636 |