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.

jan.nijtmans 2014-02-24 10:56 trunk merge
Commit 3fbdaa243d1832cedb542f68ec2e7558c281a484
2 files changed +7 -1 +20
+7 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,11 +858,17 @@
858858
continue;
859859
}
860860
zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861861
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862862
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
+ {
864870
recon_read_dir(zSubpath);
865871
}else{
866872
blob_init(&path, 0, 0);
867873
blob_appendf(&path, "%s", zSubpath);
868874
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
869875
--- 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 @@
486486
blob_appendf(pPath, "/%s", zUtf8);
487487
zPath = blob_str(pPath);
488488
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
489489
glob_match(pIgnore2, &zPath[nPrefix+1]) ){
490490
/* 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
491495
}else if( file_wd_isdir(zPath)==1 ){
496
+#endif
492497
if( !vfile_top_of_checkout(zPath) ){
493498
vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2);
494499
}
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
495504
}else if( file_wd_isfile_or_link(zPath) ){
505
+#endif
496506
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){
497507
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
498508
db_step(&ins);
499509
db_reset(&ins);
500510
}
@@ -593,11 +603,16 @@
593603
zPath = blob_str(pPath);
594604
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
595605
glob_match(pIgnore2, &zPath[nPrefix+1]) ||
596606
glob_match(pIgnore3, &zPath[nPrefix+1]) ){
597607
/* 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
598612
}else if( file_wd_isdir(zPath)==1 ){
613
+#endif
599614
if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
600615
char *zSavePath = mprintf("%s", zPath);
601616
int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
602617
pIgnore2, pIgnore3);
603618
db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
@@ -605,11 +620,16 @@
605620
db_step(&ins);
606621
db_reset(&ins);
607622
fossil_free(zSavePath);
608623
result += count; /* found X normal files? */
609624
}
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
610629
}else if( file_wd_isfile_or_link(zPath) ){
630
+#endif
611631
db_bind_text(&upd, ":file", zOrigPath);
612632
db_step(&upd);
613633
db_reset(&upd);
614634
result++; /* found 1 normal file */
615635
}
616636
--- 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

Keyboard Shortcuts

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