︙ | | | ︙ | |
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
return 0;
}
/*
** Print the "Index:" message that patches wants to see at the top of a diff.
*/
void diff_print_index(const char *zFile, u64 diffFlags){
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
fossil_print("%s", z);
fossil_free(z);
}
}
/*
|
|
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
return 0;
}
/*
** Print the "Index:" message that patches wants to see at the top of a diff.
*/
void diff_print_index(const char *zFile, u64 diffFlags){
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT))==0 ){
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
fossil_print("%s", z);
fossil_free(z);
}
}
/*
|
︙ | | | ︙ | |
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
blob_zero(&out);
if( fSwapDiff ){
text_diff(&file2, pFile1, &out, 0, diffFlags);
}else{
text_diff(pFile1, &file2, &out, 0, diffFlags);
}
if( blob_size(&out) ){
diff_print_filenames(zName, zName2, diffFlags);
fossil_print("%s\n", blob_str(&out));
}
blob_reset(&out);
}
/* Release memory resources */
blob_reset(&file2);
}else{
|
>
>
>
|
|
>
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
blob_zero(&out);
if( fSwapDiff ){
text_diff(&file2, pFile1, &out, 0, diffFlags);
}else{
text_diff(pFile1, &file2, &out, 0, diffFlags);
}
if( blob_size(&out) ){
if( diffFlags & DIFF_NUMSTAT ){
fossil_print("%s %s\n", blob_str(&out), zName);
}else{
diff_print_filenames(zName, zName2, diffFlags);
fossil_print("%s\n", blob_str(&out));
}
}
blob_reset(&out);
}
/* Release memory resources */
blob_reset(&file2);
}else{
|
︙ | | | ︙ | |
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
){
if( diffFlags & DIFF_BRIEF ) return;
if( zDiffCmd==0 ){
Blob out; /* Diff output text */
blob_zero(&out);
text_diff(pFile1, pFile2, &out, 0, diffFlags);
diff_print_filenames(zName, zName, diffFlags);
fossil_print("%s\n", blob_str(&out));
/* Release memory resources */
blob_reset(&out);
}else{
Blob cmd;
Blob temp1;
Blob temp2;
Blob prefix1;
|
>
>
>
|
|
|
>
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
){
if( diffFlags & DIFF_BRIEF ) return;
if( zDiffCmd==0 ){
Blob out; /* Diff output text */
blob_zero(&out);
text_diff(pFile1, pFile2, &out, 0, diffFlags);
if( diffFlags & DIFF_NUMSTAT ){
fossil_print("%s %s\n", blob_str(&out), zName);
}else{
diff_print_filenames(zName, zName, diffFlags);
fossil_print("%s\n", blob_str(&out));
}
/* Release memory resources */
blob_reset(&out);
}else{
Blob cmd;
Blob temp1;
Blob temp2;
Blob prefix1;
|
︙ | | | ︙ | |
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
u64 diffFlags, /* Flags controlling diff output */
FileDirList *pFileDir /* Which files to diff */
){
int vid;
Blob sql;
Stmt q;
int asNewFile; /* Treat non-existant files as empty files */
asNewFile = (diffFlags & DIFF_VERBOSE)!=0;
vid = db_lget_int("checkout", 0);
vfile_check_signature(vid, CKSIG_ENOTFILE);
blob_zero(&sql);
db_begin_transaction();
if( zFrom ){
int rid = name_to_typed_rid(zFrom, "ci");
if( !is_a_version(rid) ){
|
>
|
>
|
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
|
u64 diffFlags, /* Flags controlling diff output */
FileDirList *pFileDir /* Which files to diff */
){
int vid;
Blob sql;
Stmt q;
int asNewFile; /* Treat non-existant files as empty files */
int isNumStat; /* True for --numstat */
asNewFile = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0;
isNumStat = (diffFlags & DIFF_NUMSTAT)!=0;
vid = db_lget_int("checkout", 0);
vfile_check_signature(vid, CKSIG_ENOTFILE);
blob_zero(&sql);
db_begin_transaction();
if( zFrom ){
int rid = name_to_typed_rid(zFrom, "ci");
if( !is_a_version(rid) ){
|
︙ | | | ︙ | |
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
|
file_relative_name(zPathname, &fname, 1);
}else{
blob_set(&fname, g.zLocalRoot);
blob_append(&fname, zPathname, -1);
}
zFullName = blob_str(&fname);
if( isDeleted ){
fossil_print("DELETED %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; zFullName = NULL_DEVICE; }
}else if( file_access(zFullName, F_OK) ){
fossil_print("MISSING %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; }
}else if( isNew ){
fossil_print("ADDED %s\n", zPathname);
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}else if( isChnged==3 ){
fossil_print("ADDED_BY_MERGE %s\n", zPathname);
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}else if( isChnged==5 ){
fossil_print("ADDED_BY_INTEGRATE %s\n", zPathname);
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}
if( showDiff ){
Blob content;
int isBin;
if( !isLink != !file_wd_islink(zFullName) ){
|
|
|
|
|
|
|
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
|
file_relative_name(zPathname, &fname, 1);
}else{
blob_set(&fname, g.zLocalRoot);
blob_append(&fname, zPathname, -1);
}
zFullName = blob_str(&fname);
if( isDeleted ){
if( !isNumStat ){ fossil_print("DELETED %s\n", zPathname); }
if( !asNewFile ){ showDiff = 0; zFullName = NULL_DEVICE; }
}else if( file_access(zFullName, F_OK) ){
if( !isNumStat ){ fossil_print("MISSING %s\n", zPathname); }
if( !asNewFile ){ showDiff = 0; }
}else if( isNew ){
if( !isNumStat ){ fossil_print("ADDED %s\n", zPathname); }
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}else if( isChnged==3 ){
if( !isNumStat ){ fossil_print("ADDED_BY_MERGE %s\n", zPathname); }
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}else if( isChnged==5 ){
if( !isNumStat ){ fossil_print("ADDED_BY_INTEGRATE %s\n", zPathname); }
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}
if( showDiff ){
Blob content;
int isBin;
if( !isLink != !file_wd_islink(zFullName) ){
|
︙ | | | ︙ | |
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
|
const char *zBinGlob,
int fIncludeBinary,
u64 diffFlags,
FileDirList *pFileDir
){
Manifest *pFrom, *pTo;
ManifestFile *pFromFile, *pToFile;
int asNewFlag = (diffFlags & DIFF_VERBOSE)!=0 ? 1 : 0;
pFrom = manifest_get_by_name(zFrom, 0);
manifest_file_rewind(pFrom);
pFromFile = manifest_file_next(pFrom,0);
pTo = manifest_get_by_name(zTo, 0);
manifest_file_rewind(pTo);
pToFile = manifest_file_next(pTo,0);
while( pFromFile || pToFile ){
int cmp;
if( pFromFile==0 ){
cmp = +1;
}else if( pToFile==0 ){
cmp = -1;
}else{
cmp = fossil_strcmp(pFromFile->zName, pToFile->zName);
}
if( cmp<0 ){
if( file_dir_match(pFileDir, pFromFile->zName) ){
fossil_print("DELETED %s\n", pFromFile->zName);
if( asNewFlag ){
diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
fIncludeBinary, diffFlags);
}
}
pFromFile = manifest_file_next(pFrom,0);
}else if( cmp>0 ){
if( file_dir_match(pFileDir, pToFile->zName) ){
fossil_print("ADDED %s\n", pToFile->zName);
if( asNewFlag ){
diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
fIncludeBinary, diffFlags);
}
}
pToFile = manifest_file_next(pTo,0);
}else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
|
|
>
|
>
>
|
>
|
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
const char *zBinGlob,
int fIncludeBinary,
u64 diffFlags,
FileDirList *pFileDir
){
Manifest *pFrom, *pTo;
ManifestFile *pFromFile, *pToFile;
int asNewFlag = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0 ? 1 : 0;
pFrom = manifest_get_by_name(zFrom, 0);
manifest_file_rewind(pFrom);
pFromFile = manifest_file_next(pFrom,0);
pTo = manifest_get_by_name(zTo, 0);
manifest_file_rewind(pTo);
pToFile = manifest_file_next(pTo,0);
while( pFromFile || pToFile ){
int cmp;
if( pFromFile==0 ){
cmp = +1;
}else if( pToFile==0 ){
cmp = -1;
}else{
cmp = fossil_strcmp(pFromFile->zName, pToFile->zName);
}
if( cmp<0 ){
if( file_dir_match(pFileDir, pFromFile->zName) ){
if( (diffFlags & DIFF_NUMSTAT)==0 ){
fossil_print("DELETED %s\n", pFromFile->zName);
}
if( asNewFlag ){
diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
fIncludeBinary, diffFlags);
}
}
pFromFile = manifest_file_next(pFrom,0);
}else if( cmp>0 ){
if( file_dir_match(pFileDir, pToFile->zName) ){
if( (diffFlags & DIFF_NUMSTAT)==0 ){
fossil_print("ADDED %s\n", pToFile->zName);
}
if( asNewFlag ){
diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
fIncludeBinary, diffFlags);
}
}
pToFile = manifest_file_next(pTo,0);
}else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
|
︙ | | | ︙ | |
831
832
833
834
835
836
837
838
839
840
841
842
843
844
|
** --command PROG External diff program - overrides "diff-command"
** --context|-c N Use N lines of context
** --diff-binary BOOL Include binary files when using external commands
** --exec-abs-paths Force absolute path names with external commands.
** --exec-rel-paths Force relative path names with external commands.
** --from|-r VERSION Select VERSION as source for the diff
** --internal|-i Use internal diff logic
** --side-by-side|-y Side-by-side diff
** --strip-trailing-cr Strip trailing CR
** --tk Launch a Tcl/Tk GUI for display
** --to VERSION Select VERSION as target for the diff
** --undo Diff against the "undo" buffer
** --unified Unified diff
** -v|--verbose Output complete text of added or deleted files
|
>
|
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
|
** --command PROG External diff program - overrides "diff-command"
** --context|-c N Use N lines of context
** --diff-binary BOOL Include binary files when using external commands
** --exec-abs-paths Force absolute path names with external commands.
** --exec-rel-paths Force relative path names with external commands.
** --from|-r VERSION Select VERSION as source for the diff
** --internal|-i Use internal diff logic
** --numstat Show only the number of lines delete and added
** --side-by-side|-y Side-by-side diff
** --strip-trailing-cr Strip trailing CR
** --tk Launch a Tcl/Tk GUI for display
** --to VERSION Select VERSION as target for the diff
** --undo Diff against the "undo" buffer
** --unified Unified diff
** -v|--verbose Output complete text of added or deleted files
|
︙ | | | ︙ | |