Fossil SCM

Expand the "diffFlags" variable to 64-bits in order to accommodate new options to the various "diff" commands.

drh 2012-08-20 19:01 trunk
Commit 2b1767500e3cd9df1ba660809d1fe58f1e46b33b
+18 -17
--- src/diff.c
+++ src/diff.c
@@ -25,21 +25,22 @@
2525
2626
#if INTERFACE
2727
/*
2828
** Allowed flag parameters to the text_diff() and html_sbsdiff() funtions:
2929
*/
30
-#define DIFF_CONTEXT_MASK 0x0000ffff /* Lines of context. Default if 0 */
31
-#define DIFF_WIDTH_MASK 0x00ff0000 /* side-by-side column width */
32
-#define DIFF_IGNORE_EOLWS 0x01000000 /* Ignore end-of-line whitespace */
33
-#define DIFF_SIDEBYSIDE 0x02000000 /* Generate a side-by-side diff */
34
-#define DIFF_NEWFILE 0x04000000 /* Missing files are as empty files */
35
-#define DIFF_BRIEF 0x08000000 /* Show filenames only */
36
-#define DIFF_INLINE 0x00000000 /* Inline (not side-by-side) diff */
37
-#define DIFF_HTML 0x10000000 /* Render for HTML */
38
-#define DIFF_LINENO 0x20000000 /* Show line numbers in context diff */
39
-#define DIFF_NOOPT 0x40000000 /* Suppress optimizations for debug */
40
-#define DIFF_INVERT 0x80000000 /* Invert the diff for debug */
30
+#define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */
31
+#define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */
32
+#define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */
33
+#define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */
34
+#define DIFF_NEWFILE ((u64)0x04000000) /* Missing shown as empty files */
35
+#define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */
36
+#define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */
37
+#define DIFF_HTML ((u64)0x10000000) /* Render for HTML */
38
+#define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */
39
+#define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */
40
+#define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
41
+#define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
4142
4243
#endif /* INTERFACE */
4344
4445
/*
4546
** Maximum length of a line in a text file. (8192)
@@ -1427,21 +1428,21 @@
14271428
14281429
/*
14291430
** Extract the number of lines of context from diffFlags. Supply an
14301431
** appropriate default if no context width is specified.
14311432
*/
1432
-int diff_context_lines(int diffFlags){
1433
+int diff_context_lines(u64 diffFlags){
14331434
int n = diffFlags & DIFF_CONTEXT_MASK;
14341435
if( n==0 ) n = 5;
14351436
return n;
14361437
}
14371438
14381439
/*
14391440
** Extract the width of columns for side-by-side diff. Supply an
14401441
** appropriate default if no width is given.
14411442
*/
1442
-int diff_width(int diffFlags){
1443
+int diff_width(u64 diffFlags){
14431444
int w = (diffFlags & DIFF_WIDTH_MASK)/(DIFF_CONTEXT_MASK+1);
14441445
if( w==0 ) w = 80;
14451446
return w;
14461447
}
14471448
@@ -1461,11 +1462,11 @@
14611462
*/
14621463
int *text_diff(
14631464
Blob *pA_Blob, /* FROM file */
14641465
Blob *pB_Blob, /* TO file */
14651466
Blob *pOut, /* Write diff here if not NULL */
1466
- int diffFlags /* DIFF_* flags defined above */
1467
+ u64 diffFlags /* DIFF_* flags defined above */
14671468
){
14681469
int ignoreEolWs; /* Ignore whitespace at the end of lines */
14691470
int nContext; /* Amount of context to display */
14701471
DContext c;
14711472
@@ -1532,11 +1533,11 @@
15321533
** --noopt Disable optimization DIFF_NOOPT
15331534
** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
15341535
** --width|-W N N character lines. DIFF_WIDTH_MASK
15351536
*/
15361537
int diff_options(void){
1537
- int diffFlags = 0;
1538
+ u64 diffFlags = 0;
15381539
const char *z;
15391540
int f;
15401541
if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
15411542
if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
15421543
if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
@@ -1561,11 +1562,11 @@
15611562
void test_rawdiff_cmd(void){
15621563
Blob a, b;
15631564
int r;
15641565
int i;
15651566
int *R;
1566
- int diffFlags = diff_options();
1567
+ u64 diffFlags = diff_options();
15671568
if( g.argc<4 ) usage("FILE1 FILE2 ...");
15681569
blob_read_from_file(&a, g.argv[2]);
15691570
for(i=3; i<g.argc; i++){
15701571
if( i>3 ) fossil_print("-------------------------------\n");
15711572
blob_read_from_file(&b, g.argv[i]);
@@ -1583,11 +1584,11 @@
15831584
**
15841585
** Print the difference between two files. The usual diff options apply.
15851586
*/
15861587
void test_udiff_cmd(void){
15871588
Blob a, b, out;
1588
- int diffFlag = diff_options();
1589
+ u64 diffFlag = diff_options();
15891590
15901591
if( g.argc!=4 ) usage("FILE1 FILE2");
15911592
blob_read_from_file(&a, g.argv[2]);
15921593
blob_read_from_file(&b, g.argv[3]);
15931594
blob_zero(&out);
15941595
--- src/diff.c
+++ src/diff.c
@@ -25,21 +25,22 @@
25
26 #if INTERFACE
27 /*
28 ** Allowed flag parameters to the text_diff() and html_sbsdiff() funtions:
29 */
30 #define DIFF_CONTEXT_MASK 0x0000ffff /* Lines of context. Default if 0 */
31 #define DIFF_WIDTH_MASK 0x00ff0000 /* side-by-side column width */
32 #define DIFF_IGNORE_EOLWS 0x01000000 /* Ignore end-of-line whitespace */
33 #define DIFF_SIDEBYSIDE 0x02000000 /* Generate a side-by-side diff */
34 #define DIFF_NEWFILE 0x04000000 /* Missing files are as empty files */
35 #define DIFF_BRIEF 0x08000000 /* Show filenames only */
36 #define DIFF_INLINE 0x00000000 /* Inline (not side-by-side) diff */
37 #define DIFF_HTML 0x10000000 /* Render for HTML */
38 #define DIFF_LINENO 0x20000000 /* Show line numbers in context diff */
39 #define DIFF_NOOPT 0x40000000 /* Suppress optimizations for debug */
40 #define DIFF_INVERT 0x80000000 /* Invert the diff for debug */
 
41
42 #endif /* INTERFACE */
43
44 /*
45 ** Maximum length of a line in a text file. (8192)
@@ -1427,21 +1428,21 @@
1427
1428 /*
1429 ** Extract the number of lines of context from diffFlags. Supply an
1430 ** appropriate default if no context width is specified.
1431 */
1432 int diff_context_lines(int diffFlags){
1433 int n = diffFlags & DIFF_CONTEXT_MASK;
1434 if( n==0 ) n = 5;
1435 return n;
1436 }
1437
1438 /*
1439 ** Extract the width of columns for side-by-side diff. Supply an
1440 ** appropriate default if no width is given.
1441 */
1442 int diff_width(int diffFlags){
1443 int w = (diffFlags & DIFF_WIDTH_MASK)/(DIFF_CONTEXT_MASK+1);
1444 if( w==0 ) w = 80;
1445 return w;
1446 }
1447
@@ -1461,11 +1462,11 @@
1461 */
1462 int *text_diff(
1463 Blob *pA_Blob, /* FROM file */
1464 Blob *pB_Blob, /* TO file */
1465 Blob *pOut, /* Write diff here if not NULL */
1466 int diffFlags /* DIFF_* flags defined above */
1467 ){
1468 int ignoreEolWs; /* Ignore whitespace at the end of lines */
1469 int nContext; /* Amount of context to display */
1470 DContext c;
1471
@@ -1532,11 +1533,11 @@
1532 ** --noopt Disable optimization DIFF_NOOPT
1533 ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1534 ** --width|-W N N character lines. DIFF_WIDTH_MASK
1535 */
1536 int diff_options(void){
1537 int diffFlags = 0;
1538 const char *z;
1539 int f;
1540 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1541 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
1542 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
@@ -1561,11 +1562,11 @@
1561 void test_rawdiff_cmd(void){
1562 Blob a, b;
1563 int r;
1564 int i;
1565 int *R;
1566 int diffFlags = diff_options();
1567 if( g.argc<4 ) usage("FILE1 FILE2 ...");
1568 blob_read_from_file(&a, g.argv[2]);
1569 for(i=3; i<g.argc; i++){
1570 if( i>3 ) fossil_print("-------------------------------\n");
1571 blob_read_from_file(&b, g.argv[i]);
@@ -1583,11 +1584,11 @@
1583 **
1584 ** Print the difference between two files. The usual diff options apply.
1585 */
1586 void test_udiff_cmd(void){
1587 Blob a, b, out;
1588 int diffFlag = diff_options();
1589
1590 if( g.argc!=4 ) usage("FILE1 FILE2");
1591 blob_read_from_file(&a, g.argv[2]);
1592 blob_read_from_file(&b, g.argv[3]);
1593 blob_zero(&out);
1594
--- src/diff.c
+++ src/diff.c
@@ -25,21 +25,22 @@
25
26 #if INTERFACE
27 /*
28 ** Allowed flag parameters to the text_diff() and html_sbsdiff() funtions:
29 */
30 #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */
31 #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */
32 #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */
33 #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */
34 #define DIFF_NEWFILE ((u64)0x04000000) /* Missing shown as empty files */
35 #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */
36 #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */
37 #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */
38 #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */
39 #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */
40 #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
41 #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
42
43 #endif /* INTERFACE */
44
45 /*
46 ** Maximum length of a line in a text file. (8192)
@@ -1427,21 +1428,21 @@
1428
1429 /*
1430 ** Extract the number of lines of context from diffFlags. Supply an
1431 ** appropriate default if no context width is specified.
1432 */
1433 int diff_context_lines(u64 diffFlags){
1434 int n = diffFlags & DIFF_CONTEXT_MASK;
1435 if( n==0 ) n = 5;
1436 return n;
1437 }
1438
1439 /*
1440 ** Extract the width of columns for side-by-side diff. Supply an
1441 ** appropriate default if no width is given.
1442 */
1443 int diff_width(u64 diffFlags){
1444 int w = (diffFlags & DIFF_WIDTH_MASK)/(DIFF_CONTEXT_MASK+1);
1445 if( w==0 ) w = 80;
1446 return w;
1447 }
1448
@@ -1461,11 +1462,11 @@
1462 */
1463 int *text_diff(
1464 Blob *pA_Blob, /* FROM file */
1465 Blob *pB_Blob, /* TO file */
1466 Blob *pOut, /* Write diff here if not NULL */
1467 u64 diffFlags /* DIFF_* flags defined above */
1468 ){
1469 int ignoreEolWs; /* Ignore whitespace at the end of lines */
1470 int nContext; /* Amount of context to display */
1471 DContext c;
1472
@@ -1532,11 +1533,11 @@
1533 ** --noopt Disable optimization DIFF_NOOPT
1534 ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1535 ** --width|-W N N character lines. DIFF_WIDTH_MASK
1536 */
1537 int diff_options(void){
1538 u64 diffFlags = 0;
1539 const char *z;
1540 int f;
1541 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1542 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>0 ){
1543 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
@@ -1561,11 +1562,11 @@
1562 void test_rawdiff_cmd(void){
1563 Blob a, b;
1564 int r;
1565 int i;
1566 int *R;
1567 u64 diffFlags = diff_options();
1568 if( g.argc<4 ) usage("FILE1 FILE2 ...");
1569 blob_read_from_file(&a, g.argv[2]);
1570 for(i=3; i<g.argc; i++){
1571 if( i>3 ) fossil_print("-------------------------------\n");
1572 blob_read_from_file(&b, g.argv[i]);
@@ -1583,11 +1584,11 @@
1584 **
1585 ** Print the difference between two files. The usual diff options apply.
1586 */
1587 void test_udiff_cmd(void){
1588 Blob a, b, out;
1589 u64 diffFlag = diff_options();
1590
1591 if( g.argc!=4 ) usage("FILE1 FILE2");
1592 blob_read_from_file(&a, g.argv[2]);
1593 blob_read_from_file(&b, g.argv[3]);
1594 blob_zero(&out);
1595
+10 -10
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -31,11 +31,11 @@
3131
#endif
3232
3333
/*
3434
** Print the "Index:" message that patches wants to see at the top of a diff.
3535
*/
36
-void diff_print_index(const char *zFile, int diffFlags){
36
+void diff_print_index(const char *zFile, u64 diffFlags){
3737
if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
3838
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
3939
fossil_print("%s", z);
4040
fossil_free(z);
4141
}
@@ -42,11 +42,11 @@
4242
}
4343
4444
/*
4545
** Print the +++/--- filename lines for a diff operation.
4646
*/
47
-void diff_print_filenames(const char *zLeft, const char *zRight, int diffFlags){
47
+void diff_print_filenames(const char *zLeft, const char *zRight, u64 diffFlags){
4848
char *z = 0;
4949
if( diffFlags & DIFF_BRIEF ){
5050
/* no-op */
5151
}else if( diffFlags & DIFF_SIDEBYSIDE ){
5252
int w = diff_width(diffFlags);
@@ -75,11 +75,11 @@
7575
void diff_file(
7676
Blob *pFile1, /* In memory content to compare from */
7777
const char *zFile2, /* On disk content to compare to */
7878
const char *zName, /* Display name of the file */
7979
const char *zDiffCmd, /* Command for comparison */
80
- int diffFlags /* Flags to control the diff */
80
+ u64 diffFlags /* Flags to control the diff */
8181
){
8282
if( zDiffCmd==0 ){
8383
Blob out; /* Diff output text */
8484
Blob file2; /* Content of zFile2 */
8585
const char *zName2; /* Name of zFile2 for display */
@@ -157,11 +157,11 @@
157157
void diff_file_mem(
158158
Blob *pFile1, /* In memory content to compare from */
159159
Blob *pFile2, /* In memory content to compare to */
160160
const char *zName, /* Display name of the file */
161161
const char *zDiffCmd, /* Command for comparison */
162
- int diffFlags /* Diff flags */
162
+ u64 diffFlags /* Diff flags */
163163
){
164164
if( diffFlags & DIFF_BRIEF ) return;
165165
if( zDiffCmd==0 ){
166166
Blob out; /* Diff output text */
167167
@@ -205,11 +205,11 @@
205205
** against the same file on disk.
206206
*/
207207
static void diff_one_against_disk(
208208
const char *zFrom, /* Name of file */
209209
const char *zDiffCmd, /* Use this "diff" command */
210
- int diffFlags, /* Diff control flags */
210
+ u64 diffFlags, /* Diff control flags */
211211
const char *zFileTreeName
212212
){
213213
Blob fname;
214214
Blob content;
215215
int isLink;
@@ -231,11 +231,11 @@
231231
** files on disk and the check-out on which they are based.
232232
*/
233233
static void diff_all_against_disk(
234234
const char *zFrom, /* Version to difference from */
235235
const char *zDiffCmd, /* Use this diff command. NULL for built-in */
236
- int diffFlags /* Flags controlling diff output */
236
+ u64 diffFlags /* Flags controlling diff output */
237237
){
238238
int vid;
239239
Blob sql;
240240
Stmt q;
241241
int asNewFile; /* Treat non-existant files as empty files */
@@ -337,11 +337,11 @@
337337
*/
338338
static void diff_one_two_versions(
339339
const char *zFrom,
340340
const char *zTo,
341341
const char *zDiffCmd,
342
- int diffFlags,
342
+ u64 diffFlags,
343343
const char *zFileTreeName
344344
){
345345
char *zName;
346346
Blob fname;
347347
Blob v1, v2;
@@ -369,11 +369,11 @@
369369
*/
370370
static void diff_manifest_entry(
371371
struct ManifestFile *pFrom,
372372
struct ManifestFile *pTo,
373373
const char *zDiffCmd,
374
- int diffFlags
374
+ u64 diffFlags
375375
){
376376
Blob f1, f2;
377377
int rid;
378378
const char *zName = pFrom ? pFrom->zName : pTo->zName;
379379
if( diffFlags & DIFF_BRIEF ) return;
@@ -400,11 +400,11 @@
400400
*/
401401
static void diff_all_two_versions(
402402
const char *zFrom,
403403
const char *zTo,
404404
const char *zDiffCmd,
405
- int diffFlags
405
+ u64 diffFlags
406406
){
407407
Manifest *pFrom, *pTo;
408408
ManifestFile *pFromFile, *pToFile;
409409
int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
410410
@@ -499,11 +499,11 @@
499499
int hasNFlag; /* True if -N or --new-file flag is used */
500500
const char *zFrom; /* Source version number */
501501
const char *zTo; /* Target version number */
502502
const char *zBranch; /* Branch to diff */
503503
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
504
- int diffFlags = 0; /* Flags to control the DIFF */
504
+ u64 diffFlags = 0; /* Flags to control the DIFF */
505505
int f;
506506
507507
isGDiff = g.argv[1][0]=='g';
508508
isInternDiff = find_option("internal","i",0)!=0;
509509
zFrom = find_option("from", "r", 1);
510510
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -31,11 +31,11 @@
31 #endif
32
33 /*
34 ** Print the "Index:" message that patches wants to see at the top of a diff.
35 */
36 void diff_print_index(const char *zFile, int diffFlags){
37 if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
38 char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
39 fossil_print("%s", z);
40 fossil_free(z);
41 }
@@ -42,11 +42,11 @@
42 }
43
44 /*
45 ** Print the +++/--- filename lines for a diff operation.
46 */
47 void diff_print_filenames(const char *zLeft, const char *zRight, int diffFlags){
48 char *z = 0;
49 if( diffFlags & DIFF_BRIEF ){
50 /* no-op */
51 }else if( diffFlags & DIFF_SIDEBYSIDE ){
52 int w = diff_width(diffFlags);
@@ -75,11 +75,11 @@
75 void diff_file(
76 Blob *pFile1, /* In memory content to compare from */
77 const char *zFile2, /* On disk content to compare to */
78 const char *zName, /* Display name of the file */
79 const char *zDiffCmd, /* Command for comparison */
80 int diffFlags /* Flags to control the diff */
81 ){
82 if( zDiffCmd==0 ){
83 Blob out; /* Diff output text */
84 Blob file2; /* Content of zFile2 */
85 const char *zName2; /* Name of zFile2 for display */
@@ -157,11 +157,11 @@
157 void diff_file_mem(
158 Blob *pFile1, /* In memory content to compare from */
159 Blob *pFile2, /* In memory content to compare to */
160 const char *zName, /* Display name of the file */
161 const char *zDiffCmd, /* Command for comparison */
162 int diffFlags /* Diff flags */
163 ){
164 if( diffFlags & DIFF_BRIEF ) return;
165 if( zDiffCmd==0 ){
166 Blob out; /* Diff output text */
167
@@ -205,11 +205,11 @@
205 ** against the same file on disk.
206 */
207 static void diff_one_against_disk(
208 const char *zFrom, /* Name of file */
209 const char *zDiffCmd, /* Use this "diff" command */
210 int diffFlags, /* Diff control flags */
211 const char *zFileTreeName
212 ){
213 Blob fname;
214 Blob content;
215 int isLink;
@@ -231,11 +231,11 @@
231 ** files on disk and the check-out on which they are based.
232 */
233 static void diff_all_against_disk(
234 const char *zFrom, /* Version to difference from */
235 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
236 int diffFlags /* Flags controlling diff output */
237 ){
238 int vid;
239 Blob sql;
240 Stmt q;
241 int asNewFile; /* Treat non-existant files as empty files */
@@ -337,11 +337,11 @@
337 */
338 static void diff_one_two_versions(
339 const char *zFrom,
340 const char *zTo,
341 const char *zDiffCmd,
342 int diffFlags,
343 const char *zFileTreeName
344 ){
345 char *zName;
346 Blob fname;
347 Blob v1, v2;
@@ -369,11 +369,11 @@
369 */
370 static void diff_manifest_entry(
371 struct ManifestFile *pFrom,
372 struct ManifestFile *pTo,
373 const char *zDiffCmd,
374 int diffFlags
375 ){
376 Blob f1, f2;
377 int rid;
378 const char *zName = pFrom ? pFrom->zName : pTo->zName;
379 if( diffFlags & DIFF_BRIEF ) return;
@@ -400,11 +400,11 @@
400 */
401 static void diff_all_two_versions(
402 const char *zFrom,
403 const char *zTo,
404 const char *zDiffCmd,
405 int diffFlags
406 ){
407 Manifest *pFrom, *pTo;
408 ManifestFile *pFromFile, *pToFile;
409 int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
410
@@ -499,11 +499,11 @@
499 int hasNFlag; /* True if -N or --new-file flag is used */
500 const char *zFrom; /* Source version number */
501 const char *zTo; /* Target version number */
502 const char *zBranch; /* Branch to diff */
503 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
504 int diffFlags = 0; /* Flags to control the DIFF */
505 int f;
506
507 isGDiff = g.argv[1][0]=='g';
508 isInternDiff = find_option("internal","i",0)!=0;
509 zFrom = find_option("from", "r", 1);
510
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -31,11 +31,11 @@
31 #endif
32
33 /*
34 ** Print the "Index:" message that patches wants to see at the top of a diff.
35 */
36 void diff_print_index(const char *zFile, u64 diffFlags){
37 if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF))==0 ){
38 char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
39 fossil_print("%s", z);
40 fossil_free(z);
41 }
@@ -42,11 +42,11 @@
42 }
43
44 /*
45 ** Print the +++/--- filename lines for a diff operation.
46 */
47 void diff_print_filenames(const char *zLeft, const char *zRight, u64 diffFlags){
48 char *z = 0;
49 if( diffFlags & DIFF_BRIEF ){
50 /* no-op */
51 }else if( diffFlags & DIFF_SIDEBYSIDE ){
52 int w = diff_width(diffFlags);
@@ -75,11 +75,11 @@
75 void diff_file(
76 Blob *pFile1, /* In memory content to compare from */
77 const char *zFile2, /* On disk content to compare to */
78 const char *zName, /* Display name of the file */
79 const char *zDiffCmd, /* Command for comparison */
80 u64 diffFlags /* Flags to control the diff */
81 ){
82 if( zDiffCmd==0 ){
83 Blob out; /* Diff output text */
84 Blob file2; /* Content of zFile2 */
85 const char *zName2; /* Name of zFile2 for display */
@@ -157,11 +157,11 @@
157 void diff_file_mem(
158 Blob *pFile1, /* In memory content to compare from */
159 Blob *pFile2, /* In memory content to compare to */
160 const char *zName, /* Display name of the file */
161 const char *zDiffCmd, /* Command for comparison */
162 u64 diffFlags /* Diff flags */
163 ){
164 if( diffFlags & DIFF_BRIEF ) return;
165 if( zDiffCmd==0 ){
166 Blob out; /* Diff output text */
167
@@ -205,11 +205,11 @@
205 ** against the same file on disk.
206 */
207 static void diff_one_against_disk(
208 const char *zFrom, /* Name of file */
209 const char *zDiffCmd, /* Use this "diff" command */
210 u64 diffFlags, /* Diff control flags */
211 const char *zFileTreeName
212 ){
213 Blob fname;
214 Blob content;
215 int isLink;
@@ -231,11 +231,11 @@
231 ** files on disk and the check-out on which they are based.
232 */
233 static void diff_all_against_disk(
234 const char *zFrom, /* Version to difference from */
235 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
236 u64 diffFlags /* Flags controlling diff output */
237 ){
238 int vid;
239 Blob sql;
240 Stmt q;
241 int asNewFile; /* Treat non-existant files as empty files */
@@ -337,11 +337,11 @@
337 */
338 static void diff_one_two_versions(
339 const char *zFrom,
340 const char *zTo,
341 const char *zDiffCmd,
342 u64 diffFlags,
343 const char *zFileTreeName
344 ){
345 char *zName;
346 Blob fname;
347 Blob v1, v2;
@@ -369,11 +369,11 @@
369 */
370 static void diff_manifest_entry(
371 struct ManifestFile *pFrom,
372 struct ManifestFile *pTo,
373 const char *zDiffCmd,
374 u64 diffFlags
375 ){
376 Blob f1, f2;
377 int rid;
378 const char *zName = pFrom ? pFrom->zName : pTo->zName;
379 if( diffFlags & DIFF_BRIEF ) return;
@@ -400,11 +400,11 @@
400 */
401 static void diff_all_two_versions(
402 const char *zFrom,
403 const char *zTo,
404 const char *zDiffCmd,
405 u64 diffFlags
406 ){
407 Manifest *pFrom, *pTo;
408 ManifestFile *pFromFile, *pToFile;
409 int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0;
410
@@ -499,11 +499,11 @@
499 int hasNFlag; /* True if -N or --new-file flag is used */
500 const char *zFrom; /* Source version number */
501 const char *zTo; /* Target version number */
502 const char *zBranch; /* Branch to diff */
503 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
504 u64 diffFlags = 0; /* Flags to control the DIFF */
505 int f;
506
507 isGDiff = g.argv[1][0]=='g';
508 isInternDiff = find_option("internal","i",0)!=0;
509 zFrom = find_option("from", "r", 1);
510
+7 -7
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289289
290290
291291
/*
292292
** Append the difference between two RIDs to the output
293293
*/
294
-static void append_diff(const char *zFrom, const char *zTo, int diffFlags){
294
+static void append_diff(const char *zFrom, const char *zTo, u64 diffFlags){
295295
int fromid;
296296
int toid;
297297
Blob from, to, out;
298298
if( zFrom ){
299299
fromid = uuid_to_rid(zFrom, 0);
@@ -332,11 +332,11 @@
332332
static void append_file_change_line(
333333
const char *zName, /* Name of the file that has changed */
334334
const char *zOld, /* blob.uuid before change. NULL for added files */
335335
const char *zNew, /* blob.uuid after change. NULL for deletes */
336336
const char *zOldName, /* Prior name. NULL if no name change. */
337
- int diffFlags, /* Flags for text_diff(). Zero to omit diffs */
337
+ u64 diffFlags, /* Flags for text_diff(). Zero to omit diffs */
338338
int mperm /* executable or symlink permission for zNew */
339339
){
340340
if( !g.perm.Hyperlink ){
341341
if( zNew==0 ){
342342
@ <p>Deleted %h(zName)</p>
@@ -390,12 +390,12 @@
390390
391391
/*
392392
** Construct an appropriate diffFlag for text_diff() based on query
393393
** parameters and the to boolean arguments.
394394
*/
395
-int construct_diff_flags(int showDiff, int sideBySide){
396
- int diffFlags;
395
+u64 construct_diff_flags(int showDiff, int sideBySide){
396
+ u64 diffFlags;
397397
if( showDiff==0 ){
398398
diffFlags = 0; /* Zero means do not show any diff */
399399
}else{
400400
int x;
401401
if( sideBySide ){
@@ -440,11 +440,11 @@
440440
Stmt q;
441441
int rid;
442442
int isLeaf;
443443
int showDiff; /* True to show diffs */
444444
int sideBySide; /* True for side-by-side diffs */
445
- int diffFlags; /* Flag parameter for text_diff() */
445
+ u64 diffFlags; /* Flag parameter for text_diff() */
446446
const char *zName; /* Name of the checkin to be displayed */
447447
const char *zUuid; /* UUID of zName */
448448
const char *zParent; /* UUID of the parent checkin (if any) */
449449
450450
login_check_credentials();
@@ -822,11 +822,11 @@
822822
*/
823823
void vdiff_page(void){
824824
int ridFrom, ridTo;
825825
int showDetail = 0;
826826
int sideBySide = 0;
827
- int diffFlags = 0;
827
+ u64 diffFlags = 0;
828828
Manifest *pFrom, *pTo;
829829
ManifestFile *pFileFrom, *pFileTo;
830830
const char *zBranch;
831831
832832
login_check_credentials();
@@ -1126,11 +1126,11 @@
11261126
int isPatch;
11271127
int sideBySide;
11281128
Blob c1, c2, diff, *pOut;
11291129
char *zV1;
11301130
char *zV2;
1131
- int diffFlags;
1131
+ u64 diffFlags;
11321132
const char *zStyle = "sbsdiff";
11331133
11341134
login_check_credentials();
11351135
if( !g.perm.Read ){ login_needed(); return; }
11361136
v1 = name_to_rid_www("v1");
11371137
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289
290
291 /*
292 ** Append the difference between two RIDs to the output
293 */
294 static void append_diff(const char *zFrom, const char *zTo, int diffFlags){
295 int fromid;
296 int toid;
297 Blob from, to, out;
298 if( zFrom ){
299 fromid = uuid_to_rid(zFrom, 0);
@@ -332,11 +332,11 @@
332 static void append_file_change_line(
333 const char *zName, /* Name of the file that has changed */
334 const char *zOld, /* blob.uuid before change. NULL for added files */
335 const char *zNew, /* blob.uuid after change. NULL for deletes */
336 const char *zOldName, /* Prior name. NULL if no name change. */
337 int diffFlags, /* Flags for text_diff(). Zero to omit diffs */
338 int mperm /* executable or symlink permission for zNew */
339 ){
340 if( !g.perm.Hyperlink ){
341 if( zNew==0 ){
342 @ <p>Deleted %h(zName)</p>
@@ -390,12 +390,12 @@
390
391 /*
392 ** Construct an appropriate diffFlag for text_diff() based on query
393 ** parameters and the to boolean arguments.
394 */
395 int construct_diff_flags(int showDiff, int sideBySide){
396 int diffFlags;
397 if( showDiff==0 ){
398 diffFlags = 0; /* Zero means do not show any diff */
399 }else{
400 int x;
401 if( sideBySide ){
@@ -440,11 +440,11 @@
440 Stmt q;
441 int rid;
442 int isLeaf;
443 int showDiff; /* True to show diffs */
444 int sideBySide; /* True for side-by-side diffs */
445 int diffFlags; /* Flag parameter for text_diff() */
446 const char *zName; /* Name of the checkin to be displayed */
447 const char *zUuid; /* UUID of zName */
448 const char *zParent; /* UUID of the parent checkin (if any) */
449
450 login_check_credentials();
@@ -822,11 +822,11 @@
822 */
823 void vdiff_page(void){
824 int ridFrom, ridTo;
825 int showDetail = 0;
826 int sideBySide = 0;
827 int diffFlags = 0;
828 Manifest *pFrom, *pTo;
829 ManifestFile *pFileFrom, *pFileTo;
830 const char *zBranch;
831
832 login_check_credentials();
@@ -1126,11 +1126,11 @@
1126 int isPatch;
1127 int sideBySide;
1128 Blob c1, c2, diff, *pOut;
1129 char *zV1;
1130 char *zV2;
1131 int diffFlags;
1132 const char *zStyle = "sbsdiff";
1133
1134 login_check_credentials();
1135 if( !g.perm.Read ){ login_needed(); return; }
1136 v1 = name_to_rid_www("v1");
1137
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289
290
291 /*
292 ** Append the difference between two RIDs to the output
293 */
294 static void append_diff(const char *zFrom, const char *zTo, u64 diffFlags){
295 int fromid;
296 int toid;
297 Blob from, to, out;
298 if( zFrom ){
299 fromid = uuid_to_rid(zFrom, 0);
@@ -332,11 +332,11 @@
332 static void append_file_change_line(
333 const char *zName, /* Name of the file that has changed */
334 const char *zOld, /* blob.uuid before change. NULL for added files */
335 const char *zNew, /* blob.uuid after change. NULL for deletes */
336 const char *zOldName, /* Prior name. NULL if no name change. */
337 u64 diffFlags, /* Flags for text_diff(). Zero to omit diffs */
338 int mperm /* executable or symlink permission for zNew */
339 ){
340 if( !g.perm.Hyperlink ){
341 if( zNew==0 ){
342 @ <p>Deleted %h(zName)</p>
@@ -390,12 +390,12 @@
390
391 /*
392 ** Construct an appropriate diffFlag for text_diff() based on query
393 ** parameters and the to boolean arguments.
394 */
395 u64 construct_diff_flags(int showDiff, int sideBySide){
396 u64 diffFlags;
397 if( showDiff==0 ){
398 diffFlags = 0; /* Zero means do not show any diff */
399 }else{
400 int x;
401 if( sideBySide ){
@@ -440,11 +440,11 @@
440 Stmt q;
441 int rid;
442 int isLeaf;
443 int showDiff; /* True to show diffs */
444 int sideBySide; /* True for side-by-side diffs */
445 u64 diffFlags; /* Flag parameter for text_diff() */
446 const char *zName; /* Name of the checkin to be displayed */
447 const char *zUuid; /* UUID of zName */
448 const char *zParent; /* UUID of the parent checkin (if any) */
449
450 login_check_credentials();
@@ -822,11 +822,11 @@
822 */
823 void vdiff_page(void){
824 int ridFrom, ridTo;
825 int showDetail = 0;
826 int sideBySide = 0;
827 u64 diffFlags = 0;
828 Manifest *pFrom, *pTo;
829 ManifestFile *pFileFrom, *pFileTo;
830 const char *zBranch;
831
832 login_check_credentials();
@@ -1126,11 +1126,11 @@
1126 int isPatch;
1127 int sideBySide;
1128 Blob c1, c2, diff, *pOut;
1129 char *zV1;
1130 char *zV2;
1131 u64 diffFlags;
1132 const char *zStyle = "sbsdiff";
1133
1134 login_check_credentials();
1135 if( !g.perm.Read ){ login_needed(); return; }
1136 v1 = name_to_rid_www("v1");
1137
+1 -1
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -494,11 +494,11 @@
494494
int argPos = g.json.dispatchDepth;
495495
int r1 = 0, r2 = 0;
496496
Manifest * pW1 = NULL, *pW2 = NULL;
497497
Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
498498
char const * zErrTag = NULL;
499
- int diffFlags;
499
+ u64 diffFlags;
500500
char * zUuid = NULL;
501501
if( !g.perm.Hyperlink ){
502502
json_set_err(FSL_JSON_E_DENIED,
503503
"Requires 'h' permissions.");
504504
return NULL;
505505
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -494,11 +494,11 @@
494 int argPos = g.json.dispatchDepth;
495 int r1 = 0, r2 = 0;
496 Manifest * pW1 = NULL, *pW2 = NULL;
497 Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
498 char const * zErrTag = NULL;
499 int diffFlags;
500 char * zUuid = NULL;
501 if( !g.perm.Hyperlink ){
502 json_set_err(FSL_JSON_E_DENIED,
503 "Requires 'h' permissions.");
504 return NULL;
505
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -494,11 +494,11 @@
494 int argPos = g.json.dispatchDepth;
495 int r1 = 0, r2 = 0;
496 Manifest * pW1 = NULL, *pW2 = NULL;
497 Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
498 char const * zErrTag = NULL;
499 u64 diffFlags;
500 char * zUuid = NULL;
501 if( !g.perm.Hyperlink ){
502 json_set_err(FSL_JSON_E_DENIED,
503 "Requires 'h' permissions.");
504 return NULL;
505
+3 -3
--- src/stash.c
+++ src/stash.c
@@ -267,11 +267,11 @@
267267
}
268268
269269
/*
270270
** Show the diffs associate with a single stash.
271271
*/
272
-static void stash_diff(int stashid, const char *zDiffCmd, int diffFlags){
272
+static void stash_diff(int stashid, const char *zDiffCmd, u64 diffFlags){
273273
Stmt q;
274274
Blob empty;
275275
blob_zero(&empty);
276276
db_prepare(&q,
277277
"SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
@@ -550,18 +550,18 @@
550550
stashid);
551551
undo_finish();
552552
}else
553553
if( memcmp(zCmd, "diff", nCmd)==0 ){
554554
const char *zDiffCmd = db_get("diff-command", 0);
555
- int diffFlags = diff_options();
555
+ u64 diffFlags = diff_options();
556556
if( g.argc>4 ) usage("diff STASHID");
557557
stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
558558
stash_diff(stashid, zDiffCmd, diffFlags);
559559
}else
560560
if( memcmp(zCmd, "gdiff", nCmd)==0 ){
561561
const char *zDiffCmd = db_get("gdiff-command", 0);
562
- int diffFlags = diff_options();
562
+ u64 diffFlags = diff_options();
563563
if( g.argc>4 ) usage("diff STASHID");
564564
stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
565565
stash_diff(stashid, zDiffCmd, diffFlags);
566566
}else
567567
if( memcmp(zCmd, "help", nCmd)==0 ){
568568
--- src/stash.c
+++ src/stash.c
@@ -267,11 +267,11 @@
267 }
268
269 /*
270 ** Show the diffs associate with a single stash.
271 */
272 static void stash_diff(int stashid, const char *zDiffCmd, int diffFlags){
273 Stmt q;
274 Blob empty;
275 blob_zero(&empty);
276 db_prepare(&q,
277 "SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
@@ -550,18 +550,18 @@
550 stashid);
551 undo_finish();
552 }else
553 if( memcmp(zCmd, "diff", nCmd)==0 ){
554 const char *zDiffCmd = db_get("diff-command", 0);
555 int diffFlags = diff_options();
556 if( g.argc>4 ) usage("diff STASHID");
557 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
558 stash_diff(stashid, zDiffCmd, diffFlags);
559 }else
560 if( memcmp(zCmd, "gdiff", nCmd)==0 ){
561 const char *zDiffCmd = db_get("gdiff-command", 0);
562 int diffFlags = diff_options();
563 if( g.argc>4 ) usage("diff STASHID");
564 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
565 stash_diff(stashid, zDiffCmd, diffFlags);
566 }else
567 if( memcmp(zCmd, "help", nCmd)==0 ){
568
--- src/stash.c
+++ src/stash.c
@@ -267,11 +267,11 @@
267 }
268
269 /*
270 ** Show the diffs associate with a single stash.
271 */
272 static void stash_diff(int stashid, const char *zDiffCmd, u64 diffFlags){
273 Stmt q;
274 Blob empty;
275 blob_zero(&empty);
276 db_prepare(&q,
277 "SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
@@ -550,18 +550,18 @@
550 stashid);
551 undo_finish();
552 }else
553 if( memcmp(zCmd, "diff", nCmd)==0 ){
554 const char *zDiffCmd = db_get("diff-command", 0);
555 u64 diffFlags = diff_options();
556 if( g.argc>4 ) usage("diff STASHID");
557 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
558 stash_diff(stashid, zDiffCmd, diffFlags);
559 }else
560 if( memcmp(zCmd, "gdiff", nCmd)==0 ){
561 const char *zDiffCmd = db_get("gdiff-command", 0);
562 u64 diffFlags = diff_options();
563 if( g.argc>4 ) usage("diff STASHID");
564 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
565 stash_diff(stashid, zDiffCmd, diffFlags);
566 }else
567 if( memcmp(zCmd, "help", nCmd)==0 ){
568
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -637,11 +637,11 @@
637637
char *zTitle;
638638
int rid1, rid2;
639639
const char *zPageName;
640640
Manifest *pW1, *pW2 = 0;
641641
Blob w1, w2, d;
642
- int diffFlags;
642
+ u64 diffFlags;
643643
644644
login_check_credentials();
645645
rid1 = atoi(PD("a","0"));
646646
if( !g.perm.Hyperlink ){ login_needed(); return; }
647647
if( rid1==0 ) fossil_redirect_home();
648648
--- src/wiki.c
+++ src/wiki.c
@@ -637,11 +637,11 @@
637 char *zTitle;
638 int rid1, rid2;
639 const char *zPageName;
640 Manifest *pW1, *pW2 = 0;
641 Blob w1, w2, d;
642 int diffFlags;
643
644 login_check_credentials();
645 rid1 = atoi(PD("a","0"));
646 if( !g.perm.Hyperlink ){ login_needed(); return; }
647 if( rid1==0 ) fossil_redirect_home();
648
--- src/wiki.c
+++ src/wiki.c
@@ -637,11 +637,11 @@
637 char *zTitle;
638 int rid1, rid2;
639 const char *zPageName;
640 Manifest *pW1, *pW2 = 0;
641 Blob w1, w2, d;
642 u64 diffFlags;
643
644 login_check_credentials();
645 rid1 = atoi(PD("a","0"));
646 if( !g.perm.Hyperlink ){ login_needed(); return; }
647 if( rid1==0 ) fossil_redirect_home();
648

Keyboard Shortcuts

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