Fossil SCM

(x)diff --context N, where N is a negative value, is now treated as infinite, per off-list feature request.

stephan 2023-03-15 10:40 trunk
Commit 16d3d8b05eb100a76b9a953544fda1b4c677f2fceed2f57cc554081f5e5129f7
2 files changed +3 -3 +3 -2
+3 -3
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
28862886
*/
28872887
int diff_context_lines(DiffConfig *pCfg){
28882888
const int dflt = 5;
28892889
if(pCfg!=0){
28902890
int n = pCfg->nContext;
2891
- if( n<=0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892
- return n;
2891
+ if( n==0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892
+ return n<0 ? 0x7ffffff : n;
28932893
}else{
28942894
return dflt;
28952895
}
28962896
}
28972897
@@ -3147,11 +3147,11 @@
31473147
/* Undocumented and unsupported flags used for development
31483148
** debugging and analysis: */
31493149
if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
31503150
if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
31513151
}
3152
- if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
3152
+ if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
31533153
pCfg->nContext = f;
31543154
diffFlags |= DIFF_CONTEXT_EX;
31553155
}
31563156
if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
31573157
pCfg->wColumn = f;
31583158
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
2886 */
2887 int diff_context_lines(DiffConfig *pCfg){
2888 const int dflt = 5;
2889 if(pCfg!=0){
2890 int n = pCfg->nContext;
2891 if( n<=0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892 return n;
2893 }else{
2894 return dflt;
2895 }
2896 }
2897
@@ -3147,11 +3147,11 @@
3147 /* Undocumented and unsupported flags used for development
3148 ** debugging and analysis: */
3149 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3150 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3151 }
3152 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
3153 pCfg->nContext = f;
3154 diffFlags |= DIFF_CONTEXT_EX;
3155 }
3156 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3157 pCfg->wColumn = f;
3158
--- src/diff.c
+++ src/diff.c
@@ -2886,12 +2886,12 @@
2886 */
2887 int diff_context_lines(DiffConfig *pCfg){
2888 const int dflt = 5;
2889 if(pCfg!=0){
2890 int n = pCfg->nContext;
2891 if( n==0 && (pCfg->diffFlags & DIFF_CONTEXT_EX)==0 ) n = dflt;
2892 return n<0 ? 0x7ffffff : n;
2893 }else{
2894 return dflt;
2895 }
2896 }
2897
@@ -3147,11 +3147,11 @@
3147 /* Undocumented and unsupported flags used for development
3148 ** debugging and analysis: */
3149 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
3150 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
3151 }
3152 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){
3153 pCfg->nContext = f;
3154 diffFlags |= DIFF_CONTEXT_EX;
3155 }
3156 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
3157 pCfg->wColumn = f;
3158
+3 -2
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368368
if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369369
tempDiffFilename = fossil_temp_filename();
370370
tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371371
diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372372
if( diffOut==0 ){
373
- fossil_fatal("unable to create temporary file \"%s\"",
373
+ fossil_fatal("unable to create temporary file \"%s\"",
374374
tempDiffFilename);
375375
}
376376
#ifndef _WIN32
377377
signal(SIGINT, diff_www_interrupt);
378378
#else
@@ -1076,11 +1076,12 @@
10761076
** --brief Show filenames only
10771077
** -b|--browser Show the diff output in a web-browser
10781078
** --by Shorthand for "--browser -y"
10791079
** -ci|--checkin VERSION Show diff of all changes in VERSION
10801080
** --command PROG External diff program. Overrides "diff-command"
1081
-** -c|--context N Show N lines of context around each change
1081
+** -c|--context N Show N lines of context around each change, with
1082
+** negative N meaning show all content
10821083
** --diff-binary BOOL Include binary files with external commands
10831084
** --exec-abs-paths Force absolute path names on external commands
10841085
** --exec-rel-paths Force relative path names on external commands
10851086
** -r|--from VERSION Select VERSION as source for the diff
10861087
** -w|--ignore-all-space Ignore white space when comparing lines
10871088
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369 tempDiffFilename = fossil_temp_filename();
370 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372 if( diffOut==0 ){
373 fossil_fatal("unable to create temporary file \"%s\"",
374 tempDiffFilename);
375 }
376 #ifndef _WIN32
377 signal(SIGINT, diff_www_interrupt);
378 #else
@@ -1076,11 +1076,12 @@
1076 ** --brief Show filenames only
1077 ** -b|--browser Show the diff output in a web-browser
1078 ** --by Shorthand for "--browser -y"
1079 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1080 ** --command PROG External diff program. Overrides "diff-command"
1081 ** -c|--context N Show N lines of context around each change
 
1082 ** --diff-binary BOOL Include binary files with external commands
1083 ** --exec-abs-paths Force absolute path names on external commands
1084 ** --exec-rel-paths Force relative path names on external commands
1085 ** -r|--from VERSION Select VERSION as source for the diff
1086 ** -w|--ignore-all-space Ignore white space when comparing lines
1087
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -368,11 +368,11 @@
368 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
369 tempDiffFilename = fossil_temp_filename();
370 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
371 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
372 if( diffOut==0 ){
373 fossil_fatal("unable to create temporary file \"%s\"",
374 tempDiffFilename);
375 }
376 #ifndef _WIN32
377 signal(SIGINT, diff_www_interrupt);
378 #else
@@ -1076,11 +1076,12 @@
1076 ** --brief Show filenames only
1077 ** -b|--browser Show the diff output in a web-browser
1078 ** --by Shorthand for "--browser -y"
1079 ** -ci|--checkin VERSION Show diff of all changes in VERSION
1080 ** --command PROG External diff program. Overrides "diff-command"
1081 ** -c|--context N Show N lines of context around each change, with
1082 ** negative N meaning show all content
1083 ** --diff-binary BOOL Include binary files with external commands
1084 ** --exec-abs-paths Force absolute path names on external commands
1085 ** --exec-rel-paths Force relative path names on external commands
1086 ** -r|--from VERSION Select VERSION as source for the diff
1087 ** -w|--ignore-all-space Ignore white space when comparing lines
1088

Keyboard Shortcuts

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