Fossil SCM

merged in trunk [3e141b792c].

stephan 2011-09-28 12:09 UTC json merge
Commit 033e2eb1dfabdf20d0eff6a84c011eb6a65ba2e4
+2 -2
--- src/add.c
+++ src/add.c
@@ -228,11 +228,11 @@
228228
int isDir;
229229
Blob fullName;
230230
231231
file_canonical_name(g.argv[i], &fullName);
232232
zName = blob_str(&fullName);
233
- isDir = file_isdir(zName);
233
+ isDir = file_wd_isdir(zName);
234234
if( isDir==1 ){
235235
vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore);
236236
}else if( isDir==0 ){
237237
fossil_fatal("not found: %s", zName);
238238
}else if( file_access(zName, R_OK) ){
@@ -506,11 +506,11 @@
506506
"UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
507507
);
508508
db_multi_exec(
509509
"CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
510510
);
511
- if( file_isdir(zDest)!=1 ){
511
+ if( file_wd_isdir(zDest)!=1 ){
512512
Blob orig;
513513
if( g.argc!=4 ){
514514
usage("OLDNAME NEWNAME");
515515
}
516516
file_tree_name(g.argv[2], &orig, 1);
517517
--- src/add.c
+++ src/add.c
@@ -228,11 +228,11 @@
228 int isDir;
229 Blob fullName;
230
231 file_canonical_name(g.argv[i], &fullName);
232 zName = blob_str(&fullName);
233 isDir = file_isdir(zName);
234 if( isDir==1 ){
235 vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore);
236 }else if( isDir==0 ){
237 fossil_fatal("not found: %s", zName);
238 }else if( file_access(zName, R_OK) ){
@@ -506,11 +506,11 @@
506 "UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
507 );
508 db_multi_exec(
509 "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
510 );
511 if( file_isdir(zDest)!=1 ){
512 Blob orig;
513 if( g.argc!=4 ){
514 usage("OLDNAME NEWNAME");
515 }
516 file_tree_name(g.argv[2], &orig, 1);
517
--- src/add.c
+++ src/add.c
@@ -228,11 +228,11 @@
228 int isDir;
229 Blob fullName;
230
231 file_canonical_name(g.argv[i], &fullName);
232 zName = blob_str(&fullName);
233 isDir = file_wd_isdir(zName);
234 if( isDir==1 ){
235 vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore);
236 }else if( isDir==0 ){
237 fossil_fatal("not found: %s", zName);
238 }else if( file_access(zName, R_OK) ){
@@ -506,11 +506,11 @@
506 "UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
507 );
508 db_multi_exec(
509 "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
510 );
511 if( file_wd_isdir(zDest)!=1 ){
512 Blob orig;
513 if( g.argc!=4 ){
514 usage("OLDNAME NEWNAME");
515 }
516 file_tree_name(g.argv[2], &orig, 1);
517
+1 -1
--- src/file.c
+++ src/file.c
@@ -394,11 +394,11 @@
394394
** with the same name.
395395
**
396396
** Return the number of errors.
397397
*/
398398
int file_mkdir(const char *zName, int forceFlag){
399
- int rc = file_isdir(zName);
399
+ int rc = file_wd_isdir(zName);
400400
if( rc==2 ){
401401
if( !forceFlag ) return 1;
402402
file_delete(zName);
403403
}
404404
if( rc!=1 ){
405405
--- src/file.c
+++ src/file.c
@@ -394,11 +394,11 @@
394 ** with the same name.
395 **
396 ** Return the number of errors.
397 */
398 int file_mkdir(const char *zName, int forceFlag){
399 int rc = file_isdir(zName);
400 if( rc==2 ){
401 if( !forceFlag ) return 1;
402 file_delete(zName);
403 }
404 if( rc!=1 ){
405
--- src/file.c
+++ src/file.c
@@ -394,11 +394,11 @@
394 ** with the same name.
395 **
396 ** Return the number of errors.
397 */
398 int file_mkdir(const char *zName, int forceFlag){
399 int rc = file_wd_isdir(zName);
400 if( rc==2 ){
401 if( !forceFlag ) return 1;
402 file_delete(zName);
403 }
404 if( rc!=1 ){
405
+5 -4
--- src/gzip.c
+++ src/gzip.c
@@ -47,20 +47,21 @@
4747
}
4848
4949
/*
5050
** Begin constructing a gzip file.
5151
*/
52
-void gzip_begin(void){
52
+void gzip_begin(sqlite3_int64 now){
5353
char aHdr[10];
54
- sqlite3_int64 now;
5554
assert( gzip.eState==0 );
5655
blob_zero(&gzip.out);
5756
aHdr[0] = 0x1f;
5857
aHdr[1] = 0x8b;
5958
aHdr[2] = 8;
6059
aHdr[3] = 0;
61
- now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0");
60
+ if( now==0 ){
61
+ now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0");
62
+ }
6263
put32(&aHdr[4], now&0xffffffff);
6364
aHdr[8] = 2;
6465
aHdr[9] = 255;
6566
blob_append(&gzip.out, aHdr, 10);
6667
gzip.iCRC = 0;
@@ -125,15 +126,15 @@
125126
void test_gzip_cmd(void){
126127
Blob b;
127128
char *zOut;
128129
if( g.argc!=3 ) usage("FILENAME");
129130
sqlite3_open(":memory:", &g.db);
130
- gzip_begin();
131
+ gzip_begin(0);
131132
blob_read_from_file(&b, g.argv[2]);
132133
zOut = mprintf("%s.gz", g.argv[2]);
133134
gzip_step(blob_buffer(&b), blob_size(&b));
134135
blob_reset(&b);
135136
gzip_finish(&b);
136137
blob_write_to_file(&b, zOut);
137138
blob_reset(&b);
138139
fossil_free(zOut);
139140
}
140141
--- src/gzip.c
+++ src/gzip.c
@@ -47,20 +47,21 @@
47 }
48
49 /*
50 ** Begin constructing a gzip file.
51 */
52 void gzip_begin(void){
53 char aHdr[10];
54 sqlite3_int64 now;
55 assert( gzip.eState==0 );
56 blob_zero(&gzip.out);
57 aHdr[0] = 0x1f;
58 aHdr[1] = 0x8b;
59 aHdr[2] = 8;
60 aHdr[3] = 0;
61 now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0");
 
 
62 put32(&aHdr[4], now&0xffffffff);
63 aHdr[8] = 2;
64 aHdr[9] = 255;
65 blob_append(&gzip.out, aHdr, 10);
66 gzip.iCRC = 0;
@@ -125,15 +126,15 @@
125 void test_gzip_cmd(void){
126 Blob b;
127 char *zOut;
128 if( g.argc!=3 ) usage("FILENAME");
129 sqlite3_open(":memory:", &g.db);
130 gzip_begin();
131 blob_read_from_file(&b, g.argv[2]);
132 zOut = mprintf("%s.gz", g.argv[2]);
133 gzip_step(blob_buffer(&b), blob_size(&b));
134 blob_reset(&b);
135 gzip_finish(&b);
136 blob_write_to_file(&b, zOut);
137 blob_reset(&b);
138 fossil_free(zOut);
139 }
140
--- src/gzip.c
+++ src/gzip.c
@@ -47,20 +47,21 @@
47 }
48
49 /*
50 ** Begin constructing a gzip file.
51 */
52 void gzip_begin(sqlite3_int64 now){
53 char aHdr[10];
 
54 assert( gzip.eState==0 );
55 blob_zero(&gzip.out);
56 aHdr[0] = 0x1f;
57 aHdr[1] = 0x8b;
58 aHdr[2] = 8;
59 aHdr[3] = 0;
60 if( now==0 ){
61 now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0");
62 }
63 put32(&aHdr[4], now&0xffffffff);
64 aHdr[8] = 2;
65 aHdr[9] = 255;
66 blob_append(&gzip.out, aHdr, 10);
67 gzip.iCRC = 0;
@@ -125,15 +126,15 @@
126 void test_gzip_cmd(void){
127 Blob b;
128 char *zOut;
129 if( g.argc!=3 ) usage("FILENAME");
130 sqlite3_open(":memory:", &g.db);
131 gzip_begin(0);
132 blob_read_from_file(&b, g.argv[2]);
133 zOut = mprintf("%s.gz", g.argv[2]);
134 gzip_step(blob_buffer(&b), blob_size(&b));
135 blob_reset(&b);
136 gzip_finish(&b);
137 blob_write_to_file(&b, zOut);
138 blob_reset(&b);
139 fossil_free(zOut);
140 }
141
+1
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153153
154154
/* For defense against Cross-site Request Forgery attacks */
155155
char zCsrfToken[12]; /* Value of the anti-CSRF token */
156156
int okCsrf; /* Anti-CSRF token is present and valid */
157157
158
+ int parseCnt[10]; /* Counts of artifacts parsed */
158159
FILE *fDebug; /* Write debug information here, if the file exists */
159160
int thTrace; /* True to enable TH1 debugging output */
160161
Blob thLog; /* Text of the TH1 debugging output */
161162
162163
int isHome; /* True if rendering the "home" page */
163164
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153
154 /* For defense against Cross-site Request Forgery attacks */
155 char zCsrfToken[12]; /* Value of the anti-CSRF token */
156 int okCsrf; /* Anti-CSRF token is present and valid */
157
 
158 FILE *fDebug; /* Write debug information here, if the file exists */
159 int thTrace; /* True to enable TH1 debugging output */
160 Blob thLog; /* Text of the TH1 debugging output */
161
162 int isHome; /* True if rendering the "home" page */
163
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153
154 /* For defense against Cross-site Request Forgery attacks */
155 char zCsrfToken[12]; /* Value of the anti-CSRF token */
156 int okCsrf; /* Anti-CSRF token is present and valid */
157
158 int parseCnt[10]; /* Counts of artifacts parsed */
159 FILE *fDebug; /* Write debug information here, if the file exists */
160 int thTrace; /* True to enable TH1 debugging output */
161 Blob thLog; /* Text of the TH1 debugging output */
162
163 int isHome; /* True if rendering the "home" page */
164
+1
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153153
154154
/* For defense against Cross-site Request Forgery attacks */
155155
char zCsrfToken[12]; /* Value of the anti-CSRF token */
156156
int okCsrf; /* Anti-CSRF token is present and valid */
157157
158
+ int parseCnt[10]; /* Counts of artifacts parsed */
158159
FILE *fDebug; /* Write debug information here, if the file exists */
159160
int thTrace; /* True to enable TH1 debugging output */
160161
Blob thLog; /* Text of the TH1 debugging output */
161162
162163
int isHome; /* True if rendering the "home" page */
163164
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153
154 /* For defense against Cross-site Request Forgery attacks */
155 char zCsrfToken[12]; /* Value of the anti-CSRF token */
156 int okCsrf; /* Anti-CSRF token is present and valid */
157
 
158 FILE *fDebug; /* Write debug information here, if the file exists */
159 int thTrace; /* True to enable TH1 debugging output */
160 Blob thLog; /* Text of the TH1 debugging output */
161
162 int isHome; /* True if rendering the "home" page */
163
--- src/main.c
+++ src/main.c
@@ -153,10 +153,11 @@
153
154 /* For defense against Cross-site Request Forgery attacks */
155 char zCsrfToken[12]; /* Value of the anti-CSRF token */
156 int okCsrf; /* Anti-CSRF token is present and valid */
157
158 int parseCnt[10]; /* Counts of artifacts parsed */
159 FILE *fDebug; /* Write debug information here, if the file exists */
160 int thTrace; /* True to enable TH1 debugging output */
161 Blob thLog; /* Text of the TH1 debugging output */
162
163 int isHome; /* True if rendering the "home" page */
164
--- src/manifest.c
+++ src/manifest.c
@@ -345,14 +345,24 @@
345345
char cType;
346346
char *z;
347347
int n;
348348
char *zUuid;
349349
int sz = 0;
350
+ int isRepeat;
351
+ static Bag seen;
352
+
353
+ if( bag_find(&seen, rid) ){
354
+ isRepeat = 1;
355
+ }else{
356
+ isRepeat = 0;
357
+ bag_insert(&seen, rid);
358
+ }
350359
351360
/* Every control artifact ends with a '\n' character. Exit early
352361
** if that is not the case for this artifact.
353362
*/
363
+ if( !isRepeat ) g.parseCnt[0]++;
354364
z = blob_materialize(pContent);
355365
n = blob_size(pContent);
356366
if( n<=0 || z[n-1]!='\n' ){
357367
blob_reset(pContent);
358368
return 0;
@@ -885,10 +895,11 @@
885895
if( p->zWikiTitle ) goto manifest_syntax_error;
886896
if( p->zTicketUuid ) goto manifest_syntax_error;
887897
p->type = CFTYPE_MANIFEST;
888898
}
889899
md5sum_init();
900
+ if( !isRepeat ) g.parseCnt[p->type]++;
890901
return p;
891902
892903
manifest_syntax_error:
893904
/*fprintf(stderr, "Manifest error on line %i\n", lineNo);fflush(stderr);*/
894905
md5sum_init();
895906
--- src/manifest.c
+++ src/manifest.c
@@ -345,14 +345,24 @@
345 char cType;
346 char *z;
347 int n;
348 char *zUuid;
349 int sz = 0;
 
 
 
 
 
 
 
 
 
350
351 /* Every control artifact ends with a '\n' character. Exit early
352 ** if that is not the case for this artifact.
353 */
 
354 z = blob_materialize(pContent);
355 n = blob_size(pContent);
356 if( n<=0 || z[n-1]!='\n' ){
357 blob_reset(pContent);
358 return 0;
@@ -885,10 +895,11 @@
885 if( p->zWikiTitle ) goto manifest_syntax_error;
886 if( p->zTicketUuid ) goto manifest_syntax_error;
887 p->type = CFTYPE_MANIFEST;
888 }
889 md5sum_init();
 
890 return p;
891
892 manifest_syntax_error:
893 /*fprintf(stderr, "Manifest error on line %i\n", lineNo);fflush(stderr);*/
894 md5sum_init();
895
--- src/manifest.c
+++ src/manifest.c
@@ -345,14 +345,24 @@
345 char cType;
346 char *z;
347 int n;
348 char *zUuid;
349 int sz = 0;
350 int isRepeat;
351 static Bag seen;
352
353 if( bag_find(&seen, rid) ){
354 isRepeat = 1;
355 }else{
356 isRepeat = 0;
357 bag_insert(&seen, rid);
358 }
359
360 /* Every control artifact ends with a '\n' character. Exit early
361 ** if that is not the case for this artifact.
362 */
363 if( !isRepeat ) g.parseCnt[0]++;
364 z = blob_materialize(pContent);
365 n = blob_size(pContent);
366 if( n<=0 || z[n-1]!='\n' ){
367 blob_reset(pContent);
368 return 0;
@@ -885,10 +895,11 @@
895 if( p->zWikiTitle ) goto manifest_syntax_error;
896 if( p->zTicketUuid ) goto manifest_syntax_error;
897 p->type = CFTYPE_MANIFEST;
898 }
899 md5sum_init();
900 if( !isRepeat ) g.parseCnt[p->type]++;
901 return p;
902
903 manifest_syntax_error:
904 /*fprintf(stderr, "Manifest error on line %i\n", lineNo);fflush(stderr);*/
905 md5sum_init();
906
--- src/rebuild.c
+++ src/rebuild.c
@@ -500,10 +500,11 @@
500500
** --noverify Skip the verification of changes to the BLOB table
501501
** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
502502
** --randomize Scan artifacts in a random order
503503
** --vacuum Run VACUUM on the database after rebuilding
504504
** --wal Set Write-Ahead-Log journalling mode on the database
505
+** --stats Show artifact statistics after rebuilding
505506
**
506507
** See also: deconstruct, reconstruct
507508
*/
508509
void rebuild_database(void){
509510
int forceFlag;
@@ -514,18 +515,20 @@
514515
const char *zPagesize;
515516
int newPagesize = 0;
516517
int activateWal;
517518
int runVacuum;
518519
int runCompress;
520
+ int showStats;
519521
520522
omitVerify = find_option("noverify",0,0)!=0;
521523
forceFlag = find_option("force","f",0)!=0;
522524
randomizeFlag = find_option("randomize", 0, 0)!=0;
523525
doClustering = find_option("cluster", 0, 0)!=0;
524526
runVacuum = find_option("vacuum",0,0)!=0;
525527
runCompress = find_option("compress",0,0)!=0;
526528
zPagesize = find_option("pagesize",0,1);
529
+ showStats = find_option("stats",0,0)!=0;
527530
if( zPagesize ){
528531
newPagesize = atoi(zPagesize);
529532
if( newPagesize<512 || newPagesize>65536
530533
|| (newPagesize&(newPagesize-1))!=0
531534
){
@@ -579,10 +582,30 @@
579582
}
580583
if( activateWal ){
581584
db_multi_exec("PRAGMA journal_mode=WAL;");
582585
}
583586
}
587
+ if( showStats ){
588
+ static struct { int idx; const char *zLabel; } aStat[] = {
589
+ { CFTYPE_ANY, "Artifacts:" },
590
+ { CFTYPE_MANIFEST, "Manifests:" },
591
+ { CFTYPE_CLUSTER, "Clusters:" },
592
+ { CFTYPE_CONTROL, "Tags:" },
593
+ { CFTYPE_WIKI, "Wikis:" },
594
+ { CFTYPE_TICKET, "Tickets:" },
595
+ { CFTYPE_ATTACHMENT,"Attachments:" },
596
+ { CFTYPE_EVENT, "Events:" },
597
+ };
598
+ int i;
599
+ int subtotal = 0;
600
+ for(i=0; i<count(aStat); i++){
601
+ int k = aStat[i].idx;
602
+ fossil_print("%-15s %6d\n", aStat[i].zLabel, g.parseCnt[k]);
603
+ if( k>0 ) subtotal += g.parseCnt[k];
604
+ }
605
+ fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal);
606
+ }
584607
}
585608
586609
/*
587610
** COMMAND: test-detach ?REPOSITORY?
588611
**
589612
--- src/rebuild.c
+++ src/rebuild.c
@@ -500,10 +500,11 @@
500 ** --noverify Skip the verification of changes to the BLOB table
501 ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
502 ** --randomize Scan artifacts in a random order
503 ** --vacuum Run VACUUM on the database after rebuilding
504 ** --wal Set Write-Ahead-Log journalling mode on the database
 
505 **
506 ** See also: deconstruct, reconstruct
507 */
508 void rebuild_database(void){
509 int forceFlag;
@@ -514,18 +515,20 @@
514 const char *zPagesize;
515 int newPagesize = 0;
516 int activateWal;
517 int runVacuum;
518 int runCompress;
 
519
520 omitVerify = find_option("noverify",0,0)!=0;
521 forceFlag = find_option("force","f",0)!=0;
522 randomizeFlag = find_option("randomize", 0, 0)!=0;
523 doClustering = find_option("cluster", 0, 0)!=0;
524 runVacuum = find_option("vacuum",0,0)!=0;
525 runCompress = find_option("compress",0,0)!=0;
526 zPagesize = find_option("pagesize",0,1);
 
527 if( zPagesize ){
528 newPagesize = atoi(zPagesize);
529 if( newPagesize<512 || newPagesize>65536
530 || (newPagesize&(newPagesize-1))!=0
531 ){
@@ -579,10 +582,30 @@
579 }
580 if( activateWal ){
581 db_multi_exec("PRAGMA journal_mode=WAL;");
582 }
583 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584 }
585
586 /*
587 ** COMMAND: test-detach ?REPOSITORY?
588 **
589
--- src/rebuild.c
+++ src/rebuild.c
@@ -500,10 +500,11 @@
500 ** --noverify Skip the verification of changes to the BLOB table
501 ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
502 ** --randomize Scan artifacts in a random order
503 ** --vacuum Run VACUUM on the database after rebuilding
504 ** --wal Set Write-Ahead-Log journalling mode on the database
505 ** --stats Show artifact statistics after rebuilding
506 **
507 ** See also: deconstruct, reconstruct
508 */
509 void rebuild_database(void){
510 int forceFlag;
@@ -514,18 +515,20 @@
515 const char *zPagesize;
516 int newPagesize = 0;
517 int activateWal;
518 int runVacuum;
519 int runCompress;
520 int showStats;
521
522 omitVerify = find_option("noverify",0,0)!=0;
523 forceFlag = find_option("force","f",0)!=0;
524 randomizeFlag = find_option("randomize", 0, 0)!=0;
525 doClustering = find_option("cluster", 0, 0)!=0;
526 runVacuum = find_option("vacuum",0,0)!=0;
527 runCompress = find_option("compress",0,0)!=0;
528 zPagesize = find_option("pagesize",0,1);
529 showStats = find_option("stats",0,0)!=0;
530 if( zPagesize ){
531 newPagesize = atoi(zPagesize);
532 if( newPagesize<512 || newPagesize>65536
533 || (newPagesize&(newPagesize-1))!=0
534 ){
@@ -579,10 +582,30 @@
582 }
583 if( activateWal ){
584 db_multi_exec("PRAGMA journal_mode=WAL;");
585 }
586 }
587 if( showStats ){
588 static struct { int idx; const char *zLabel; } aStat[] = {
589 { CFTYPE_ANY, "Artifacts:" },
590 { CFTYPE_MANIFEST, "Manifests:" },
591 { CFTYPE_CLUSTER, "Clusters:" },
592 { CFTYPE_CONTROL, "Tags:" },
593 { CFTYPE_WIKI, "Wikis:" },
594 { CFTYPE_TICKET, "Tickets:" },
595 { CFTYPE_ATTACHMENT,"Attachments:" },
596 { CFTYPE_EVENT, "Events:" },
597 };
598 int i;
599 int subtotal = 0;
600 for(i=0; i<count(aStat); i++){
601 int k = aStat[i].idx;
602 fossil_print("%-15s %6d\n", aStat[i].zLabel, g.parseCnt[k]);
603 if( k>0 ) subtotal += g.parseCnt[k];
604 }
605 fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal);
606 }
607 }
608
609 /*
610 ** COMMAND: test-detach ?REPOSITORY?
611 **
612
+5 -4
--- src/tar.c
+++ src/tar.c
@@ -44,11 +44,11 @@
4444
/*
4545
** Begin the process of generating a tarball.
4646
**
4747
** Initialize the GZIP compressor and the table of directory names.
4848
*/
49
-static void tar_begin(void){
49
+static void tar_begin(sqlite3_int64 mTime){
5050
assert( tball.aHdr==0 );
5151
tball.aHdr = fossil_malloc(512+512);
5252
memset(tball.aHdr, 0, 512+512);
5353
tball.zSpaces = (char*)&tball.aHdr[512];
5454
/* zPrevDir init */
@@ -60,11 +60,11 @@
6060
memcpy(&tball.aHdr[108], "0000000", 8); /* Owner ID */
6161
memcpy(&tball.aHdr[116], "0000000", 8); /* Group ID */
6262
memcpy(&tball.aHdr[257], "ustar\00000", 8); /* POSIX.1 format */
6363
memcpy(&tball.aHdr[265], "nobody", 7); /* Owner name */
6464
memcpy(&tball.aHdr[297], "nobody", 7); /* Group name */
65
- gzip_begin();
65
+ gzip_begin(mTime);
6666
db_multi_exec(
6767
"CREATE TEMP TABLE dir(name UNIQUE);"
6868
);
6969
}
7070
@@ -427,11 +427,11 @@
427427
Blob file;
428428
if( g.argc<3 ){
429429
usage("ARCHIVE FILE....");
430430
}
431431
sqlite3_open(":memory:", &g.db);
432
- tar_begin();
432
+ tar_begin(0);
433433
for(i=3; i<g.argc; i++){
434434
blob_zero(&file);
435435
blob_read_from_file(&file, g.argv[i]);
436436
tar_add_file(g.argv[i], &file,
437437
file_wd_perm(g.argv[i]), file_wd_mtime(g.argv[i]));
@@ -473,20 +473,20 @@
473473
blob_zero(pTar);
474474
return;
475475
}
476476
blob_zero(&hash);
477477
blob_zero(&filename);
478
- tar_begin();
479478
480479
if( zDir && zDir[0] ){
481480
blob_appendf(&filename, "%s/", zDir);
482481
}
483482
nPrefix = blob_size(&filename);
484483
485484
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
486485
if( pManifest ){
487486
mTime = (pManifest->rDate - 2440587.5)*86400.0;
487
+ tar_begin(mTime);
488488
if( db_get_boolean("manifest", 0) ){
489489
blob_append(&filename, "manifest", -1);
490490
zName = blob_str(&filename);
491491
tar_add_file(zName, &mfile, 0, mTime);
492492
sha1sum_blob(&mfile, &hash);
@@ -513,10 +513,11 @@
513513
}else{
514514
sha1sum_blob(&mfile, &hash);
515515
blob_append(&filename, blob_str(&hash), 16);
516516
zName = blob_str(&filename);
517517
mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;");
518
+ tar_begin(mTime);
518519
tar_add_file(zName, &mfile, 0, mTime);
519520
}
520521
manifest_destroy(pManifest);
521522
blob_reset(&mfile);
522523
blob_reset(&filename);
523524
--- src/tar.c
+++ src/tar.c
@@ -44,11 +44,11 @@
44 /*
45 ** Begin the process of generating a tarball.
46 **
47 ** Initialize the GZIP compressor and the table of directory names.
48 */
49 static void tar_begin(void){
50 assert( tball.aHdr==0 );
51 tball.aHdr = fossil_malloc(512+512);
52 memset(tball.aHdr, 0, 512+512);
53 tball.zSpaces = (char*)&tball.aHdr[512];
54 /* zPrevDir init */
@@ -60,11 +60,11 @@
60 memcpy(&tball.aHdr[108], "0000000", 8); /* Owner ID */
61 memcpy(&tball.aHdr[116], "0000000", 8); /* Group ID */
62 memcpy(&tball.aHdr[257], "ustar\00000", 8); /* POSIX.1 format */
63 memcpy(&tball.aHdr[265], "nobody", 7); /* Owner name */
64 memcpy(&tball.aHdr[297], "nobody", 7); /* Group name */
65 gzip_begin();
66 db_multi_exec(
67 "CREATE TEMP TABLE dir(name UNIQUE);"
68 );
69 }
70
@@ -427,11 +427,11 @@
427 Blob file;
428 if( g.argc<3 ){
429 usage("ARCHIVE FILE....");
430 }
431 sqlite3_open(":memory:", &g.db);
432 tar_begin();
433 for(i=3; i<g.argc; i++){
434 blob_zero(&file);
435 blob_read_from_file(&file, g.argv[i]);
436 tar_add_file(g.argv[i], &file,
437 file_wd_perm(g.argv[i]), file_wd_mtime(g.argv[i]));
@@ -473,20 +473,20 @@
473 blob_zero(pTar);
474 return;
475 }
476 blob_zero(&hash);
477 blob_zero(&filename);
478 tar_begin();
479
480 if( zDir && zDir[0] ){
481 blob_appendf(&filename, "%s/", zDir);
482 }
483 nPrefix = blob_size(&filename);
484
485 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
486 if( pManifest ){
487 mTime = (pManifest->rDate - 2440587.5)*86400.0;
 
488 if( db_get_boolean("manifest", 0) ){
489 blob_append(&filename, "manifest", -1);
490 zName = blob_str(&filename);
491 tar_add_file(zName, &mfile, 0, mTime);
492 sha1sum_blob(&mfile, &hash);
@@ -513,10 +513,11 @@
513 }else{
514 sha1sum_blob(&mfile, &hash);
515 blob_append(&filename, blob_str(&hash), 16);
516 zName = blob_str(&filename);
517 mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;");
 
518 tar_add_file(zName, &mfile, 0, mTime);
519 }
520 manifest_destroy(pManifest);
521 blob_reset(&mfile);
522 blob_reset(&filename);
523
--- src/tar.c
+++ src/tar.c
@@ -44,11 +44,11 @@
44 /*
45 ** Begin the process of generating a tarball.
46 **
47 ** Initialize the GZIP compressor and the table of directory names.
48 */
49 static void tar_begin(sqlite3_int64 mTime){
50 assert( tball.aHdr==0 );
51 tball.aHdr = fossil_malloc(512+512);
52 memset(tball.aHdr, 0, 512+512);
53 tball.zSpaces = (char*)&tball.aHdr[512];
54 /* zPrevDir init */
@@ -60,11 +60,11 @@
60 memcpy(&tball.aHdr[108], "0000000", 8); /* Owner ID */
61 memcpy(&tball.aHdr[116], "0000000", 8); /* Group ID */
62 memcpy(&tball.aHdr[257], "ustar\00000", 8); /* POSIX.1 format */
63 memcpy(&tball.aHdr[265], "nobody", 7); /* Owner name */
64 memcpy(&tball.aHdr[297], "nobody", 7); /* Group name */
65 gzip_begin(mTime);
66 db_multi_exec(
67 "CREATE TEMP TABLE dir(name UNIQUE);"
68 );
69 }
70
@@ -427,11 +427,11 @@
427 Blob file;
428 if( g.argc<3 ){
429 usage("ARCHIVE FILE....");
430 }
431 sqlite3_open(":memory:", &g.db);
432 tar_begin(0);
433 for(i=3; i<g.argc; i++){
434 blob_zero(&file);
435 blob_read_from_file(&file, g.argv[i]);
436 tar_add_file(g.argv[i], &file,
437 file_wd_perm(g.argv[i]), file_wd_mtime(g.argv[i]));
@@ -473,20 +473,20 @@
473 blob_zero(pTar);
474 return;
475 }
476 blob_zero(&hash);
477 blob_zero(&filename);
 
478
479 if( zDir && zDir[0] ){
480 blob_appendf(&filename, "%s/", zDir);
481 }
482 nPrefix = blob_size(&filename);
483
484 pManifest = manifest_get(rid, CFTYPE_MANIFEST);
485 if( pManifest ){
486 mTime = (pManifest->rDate - 2440587.5)*86400.0;
487 tar_begin(mTime);
488 if( db_get_boolean("manifest", 0) ){
489 blob_append(&filename, "manifest", -1);
490 zName = blob_str(&filename);
491 tar_add_file(zName, &mfile, 0, mTime);
492 sha1sum_blob(&mfile, &hash);
@@ -513,10 +513,11 @@
513 }else{
514 sha1sum_blob(&mfile, &hash);
515 blob_append(&filename, blob_str(&hash), 16);
516 zName = blob_str(&filename);
517 mTime = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0;");
518 tar_begin(mTime);
519 tar_add_file(zName, &mfile, 0, mTime);
520 }
521 manifest_destroy(pManifest);
522 blob_reset(&mfile);
523 blob_reset(&filename);
524
+2 -2
--- src/update.c
+++ src/update.c
@@ -302,11 +302,11 @@
302302
blob_zero(&sql);
303303
blob_append(&sql, "DELETE FROM fv WHERE ", -1);
304304
zSep = "";
305305
for(i=3; i<g.argc; i++){
306306
file_tree_name(g.argv[i], &treename, 1);
307
- if( file_isdir(g.argv[i])==1 ){
307
+ if( file_wd_isdir(g.argv[i])==1 ){
308308
if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){
309309
blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
310310
}else{
311311
blob_reset(&sql);
312312
break;
@@ -513,11 +513,11 @@
513513
514514
blob_zero(&path);
515515
blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
516516
zPath = blob_str(&path);
517517
/* Handle various cases of existence of the directory */
518
- switch( file_isdir(zPath) ){
518
+ switch( file_wd_isdir(zPath) ){
519519
case 0: { /* doesn't exist */
520520
if( file_mkdir(zPath, 0)!=0 ) {
521521
fossil_warning("couldn't create directory %s as "
522522
"required by empty-dirs setting", zDir);
523523
}
524524
--- src/update.c
+++ src/update.c
@@ -302,11 +302,11 @@
302 blob_zero(&sql);
303 blob_append(&sql, "DELETE FROM fv WHERE ", -1);
304 zSep = "";
305 for(i=3; i<g.argc; i++){
306 file_tree_name(g.argv[i], &treename, 1);
307 if( file_isdir(g.argv[i])==1 ){
308 if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){
309 blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
310 }else{
311 blob_reset(&sql);
312 break;
@@ -513,11 +513,11 @@
513
514 blob_zero(&path);
515 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
516 zPath = blob_str(&path);
517 /* Handle various cases of existence of the directory */
518 switch( file_isdir(zPath) ){
519 case 0: { /* doesn't exist */
520 if( file_mkdir(zPath, 0)!=0 ) {
521 fossil_warning("couldn't create directory %s as "
522 "required by empty-dirs setting", zDir);
523 }
524
--- src/update.c
+++ src/update.c
@@ -302,11 +302,11 @@
302 blob_zero(&sql);
303 blob_append(&sql, "DELETE FROM fv WHERE ", -1);
304 zSep = "";
305 for(i=3; i<g.argc; i++){
306 file_tree_name(g.argv[i], &treename, 1);
307 if( file_wd_isdir(g.argv[i])==1 ){
308 if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){
309 blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
310 }else{
311 blob_reset(&sql);
312 break;
@@ -513,11 +513,11 @@
513
514 blob_zero(&path);
515 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
516 zPath = blob_str(&path);
517 /* Handle various cases of existence of the directory */
518 switch( file_wd_isdir(zPath) ){
519 case 0: { /* doesn't exist */
520 if( file_mkdir(zPath, 0)!=0 ) {
521 fossil_warning("couldn't create directory %s as "
522 "required by empty-dirs setting", zDir);
523 }
524
+2 -2
--- src/vfile.c
+++ src/vfile.c
@@ -272,11 +272,11 @@
272272
blob_reset(&content);
273273
continue;
274274
}
275275
}
276276
if( verbose ) fossil_print("%s\n", &zName[nRepos]);
277
- if( file_isdir(zName) == 1 ){
277
+ if( file_wd_isdir(zName) == 1 ){
278278
/*TODO(dchest): remove directories? */
279279
fossil_fatal("%s is directory, cannot overwrite\n", zName);
280280
}
281281
if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){
282282
file_delete(zName);
@@ -389,11 +389,11 @@
389389
blob_appendf(pPath, "/%s", zUtf8);
390390
fossil_mbcs_free(zUtf8);
391391
zPath = blob_str(pPath);
392392
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
393393
/* do nothing */
394
- }else if( file_isdir(zPath)==1 ){
394
+ }else if( file_wd_isdir(zPath)==1 ){
395395
if( !vfile_top_of_checkout(zPath) ){
396396
vfile_scan(pPath, nPrefix, allFlag, pIgnore);
397397
}
398398
}else if( file_wd_isfile_or_link(zPath) ){
399399
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
400400
--- src/vfile.c
+++ src/vfile.c
@@ -272,11 +272,11 @@
272 blob_reset(&content);
273 continue;
274 }
275 }
276 if( verbose ) fossil_print("%s\n", &zName[nRepos]);
277 if( file_isdir(zName) == 1 ){
278 /*TODO(dchest): remove directories? */
279 fossil_fatal("%s is directory, cannot overwrite\n", zName);
280 }
281 if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){
282 file_delete(zName);
@@ -389,11 +389,11 @@
389 blob_appendf(pPath, "/%s", zUtf8);
390 fossil_mbcs_free(zUtf8);
391 zPath = blob_str(pPath);
392 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
393 /* do nothing */
394 }else if( file_isdir(zPath)==1 ){
395 if( !vfile_top_of_checkout(zPath) ){
396 vfile_scan(pPath, nPrefix, allFlag, pIgnore);
397 }
398 }else if( file_wd_isfile_or_link(zPath) ){
399 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
400
--- src/vfile.c
+++ src/vfile.c
@@ -272,11 +272,11 @@
272 blob_reset(&content);
273 continue;
274 }
275 }
276 if( verbose ) fossil_print("%s\n", &zName[nRepos]);
277 if( file_wd_isdir(zName) == 1 ){
278 /*TODO(dchest): remove directories? */
279 fossil_fatal("%s is directory, cannot overwrite\n", zName);
280 }
281 if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){
282 file_delete(zName);
@@ -389,11 +389,11 @@
389 blob_appendf(pPath, "/%s", zUtf8);
390 fossil_mbcs_free(zUtf8);
391 zPath = blob_str(pPath);
392 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
393 /* do nothing */
394 }else if( file_wd_isdir(zPath)==1 ){
395 if( !vfile_top_of_checkout(zPath) ){
396 vfile_scan(pPath, nPrefix, allFlag, pIgnore);
397 }
398 }else if( file_wd_isfile_or_link(zPath) ){
399 db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
400

Keyboard Shortcuts

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