Fossil SCM
merge trunk
Commit
5efa7d2e62206313ca75f01b3f3ed8bc070a7035
Parent
dc981860ee5fceb…
6 files changed
+6
-5
+6
-5
+4
-7
+1
-1
+7
+7
+6
-5
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -32,11 +32,10 @@ | ||
| 32 | 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | -#define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ | |
| 38 | 37 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 39 | 38 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 40 | 39 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 41 | 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | ||
| 114 | 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 115 | 114 | DLine *aFrom; /* File on left side of the diff */ |
| 116 | 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 117 | 116 | DLine *aTo; /* File on right side of the diff */ |
| 118 | 117 | int nTo; /* Number of lines in aTo[] */ |
| 119 | - int (*same_fn)(DLine *, DLine *); /* Function to be used for comparing */ | |
| 118 | + int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ | |
| 120 | 119 | }; |
| 121 | 120 | |
| 122 | 121 | /* |
| 123 | 122 | ** Return an array of DLine objects containing a pointer to the |
| 124 | 123 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | ||
| 167 | 166 | |
| 168 | 167 | /* Fill in the array */ |
| 169 | 168 | for(i=0; i<nLine; i++){ |
| 170 | 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 171 | 170 | a[i].z = z; |
| 171 | + k = j; | |
| 172 | 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | 174 | } |
| 175 | - a[i].n = k = j; | |
| 175 | + a[i].n = k; | |
| 176 | 176 | s = 0; |
| 177 | 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | 179 | } |
| 180 | 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | ||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /* |
| 210 | 210 | ** Return true if two DLine elements are identical. |
| 211 | 211 | */ |
| 212 | -static int same_dline(DLine *pA, DLine *pB){ | |
| 212 | +static int same_dline(const DLine *pA, const DLine *pB){ | |
| 213 | 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | 219 | ** to the first non-space character in the string. |
| 220 | 220 | */ |
| 221 | 221 | |
| 222 | -static int same_dline_ignore_allws(DLine *pA, DLine *pB){ | |
| 222 | +static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ | |
| 223 | 223 | int a = pA->indent, b = pB->indent; |
| 224 | 224 | if( pA->h==pB->h ){ |
| 225 | 225 | while( a<pA->n && b<pB->n ){ |
| 226 | 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | ||
| 2189 | 2189 | */ |
| 2190 | 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | 2191 | unsigned c; /* Result color */ |
| 2192 | 2192 | unsigned x1, x2; |
| 2193 | 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | + else if(i>=n) return c2; | |
| 2194 | 2195 | x1 = (c1>>16)&0xff; |
| 2195 | 2196 | x2 = (c2>>16)&0xff; |
| 2196 | 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2197 | 2198 | x1 = (c1>>8)&0xff; |
| 2198 | 2199 | x2 = (c2>>8)&0xff; |
| 2199 | 2200 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -32,11 +32,10 @@ | |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ |
| 38 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 39 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 40 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | |
| 114 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 115 | DLine *aFrom; /* File on left side of the diff */ |
| 116 | int nFrom; /* Number of lines in aFrom[] */ |
| 117 | DLine *aTo; /* File on right side of the diff */ |
| 118 | int nTo; /* Number of lines in aTo[] */ |
| 119 | int (*same_fn)(DLine *, DLine *); /* Function to be used for comparing */ |
| 120 | }; |
| 121 | |
| 122 | /* |
| 123 | ** Return an array of DLine objects containing a pointer to the |
| 124 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | |
| 167 | |
| 168 | /* Fill in the array */ |
| 169 | for(i=0; i<nLine; i++){ |
| 170 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 171 | a[i].z = z; |
| 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | } |
| 175 | a[i].n = k = j; |
| 176 | s = 0; |
| 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | } |
| 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Return true if two DLine elements are identical. |
| 211 | */ |
| 212 | static int same_dline(DLine *pA, DLine *pB){ |
| 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | ** to the first non-space character in the string. |
| 220 | */ |
| 221 | |
| 222 | static int same_dline_ignore_allws(DLine *pA, DLine *pB){ |
| 223 | int a = pA->indent, b = pB->indent; |
| 224 | if( pA->h==pB->h ){ |
| 225 | while( a<pA->n && b<pB->n ){ |
| 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | |
| 2189 | */ |
| 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | unsigned c; /* Result color */ |
| 2192 | unsigned x1, x2; |
| 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | x1 = (c1>>16)&0xff; |
| 2195 | x2 = (c2>>16)&0xff; |
| 2196 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2197 | x1 = (c1>>8)&0xff; |
| 2198 | x2 = (c2>>8)&0xff; |
| 2199 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -32,11 +32,10 @@ | |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 38 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | |
| 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 114 | DLine *aFrom; /* File on left side of the diff */ |
| 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 116 | DLine *aTo; /* File on right side of the diff */ |
| 117 | int nTo; /* Number of lines in aTo[] */ |
| 118 | int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ |
| 119 | }; |
| 120 | |
| 121 | /* |
| 122 | ** Return an array of DLine objects containing a pointer to the |
| 123 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | |
| 166 | |
| 167 | /* Fill in the array */ |
| 168 | for(i=0; i<nLine; i++){ |
| 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 170 | a[i].z = z; |
| 171 | k = j; |
| 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | } |
| 175 | a[i].n = k; |
| 176 | s = 0; |
| 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | } |
| 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Return true if two DLine elements are identical. |
| 211 | */ |
| 212 | static int same_dline(const DLine *pA, const DLine *pB){ |
| 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | ** to the first non-space character in the string. |
| 220 | */ |
| 221 | |
| 222 | static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ |
| 223 | int a = pA->indent, b = pB->indent; |
| 224 | if( pA->h==pB->h ){ |
| 225 | while( a<pA->n && b<pB->n ){ |
| 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | |
| 2189 | */ |
| 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | unsigned c; /* Result color */ |
| 2192 | unsigned x1, x2; |
| 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | else if(i>=n) return c2; |
| 2195 | x1 = (c1>>16)&0xff; |
| 2196 | x2 = (c2>>16)&0xff; |
| 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2198 | x1 = (c1>>8)&0xff; |
| 2199 | x2 = (c2>>8)&0xff; |
| 2200 |
+6
-5
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -32,11 +32,10 @@ | ||
| 32 | 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | -#define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ | |
| 38 | 37 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 39 | 38 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 40 | 39 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 41 | 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | ||
| 114 | 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 115 | 114 | DLine *aFrom; /* File on left side of the diff */ |
| 116 | 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 117 | 116 | DLine *aTo; /* File on right side of the diff */ |
| 118 | 117 | int nTo; /* Number of lines in aTo[] */ |
| 119 | - int (*same_fn)(DLine *, DLine *); /* Function to be used for comparing */ | |
| 118 | + int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ | |
| 120 | 119 | }; |
| 121 | 120 | |
| 122 | 121 | /* |
| 123 | 122 | ** Return an array of DLine objects containing a pointer to the |
| 124 | 123 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | ||
| 167 | 166 | |
| 168 | 167 | /* Fill in the array */ |
| 169 | 168 | for(i=0; i<nLine; i++){ |
| 170 | 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 171 | 170 | a[i].z = z; |
| 171 | + k = j; | |
| 172 | 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | 174 | } |
| 175 | - a[i].n = k = j; | |
| 175 | + a[i].n = k; | |
| 176 | 176 | s = 0; |
| 177 | 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | 179 | } |
| 180 | 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | ||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /* |
| 210 | 210 | ** Return true if two DLine elements are identical. |
| 211 | 211 | */ |
| 212 | -static int same_dline(DLine *pA, DLine *pB){ | |
| 212 | +static int same_dline(const DLine *pA, const DLine *pB){ | |
| 213 | 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /* |
| 217 | 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | 219 | ** to the first non-space character in the string. |
| 220 | 220 | */ |
| 221 | 221 | |
| 222 | -static int same_dline_ignore_allws(DLine *pA, DLine *pB){ | |
| 222 | +static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ | |
| 223 | 223 | int a = pA->indent, b = pB->indent; |
| 224 | 224 | if( pA->h==pB->h ){ |
| 225 | 225 | while( a<pA->n && b<pB->n ){ |
| 226 | 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | ||
| 2189 | 2189 | */ |
| 2190 | 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | 2191 | unsigned c; /* Result color */ |
| 2192 | 2192 | unsigned x1, x2; |
| 2193 | 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | + else if(i>=n) return c2; | |
| 2194 | 2195 | x1 = (c1>>16)&0xff; |
| 2195 | 2196 | x2 = (c2>>16)&0xff; |
| 2196 | 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2197 | 2198 | x1 = (c1>>8)&0xff; |
| 2198 | 2199 | x2 = (c2>>8)&0xff; |
| 2199 | 2200 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -32,11 +32,10 @@ | |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ |
| 38 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 39 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 40 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | |
| 114 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 115 | DLine *aFrom; /* File on left side of the diff */ |
| 116 | int nFrom; /* Number of lines in aFrom[] */ |
| 117 | DLine *aTo; /* File on right side of the diff */ |
| 118 | int nTo; /* Number of lines in aTo[] */ |
| 119 | int (*same_fn)(DLine *, DLine *); /* Function to be used for comparing */ |
| 120 | }; |
| 121 | |
| 122 | /* |
| 123 | ** Return an array of DLine objects containing a pointer to the |
| 124 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | |
| 167 | |
| 168 | /* Fill in the array */ |
| 169 | for(i=0; i<nLine; i++){ |
| 170 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 171 | a[i].z = z; |
| 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | } |
| 175 | a[i].n = k = j; |
| 176 | s = 0; |
| 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | } |
| 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Return true if two DLine elements are identical. |
| 211 | */ |
| 212 | static int same_dline(DLine *pA, DLine *pB){ |
| 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | ** to the first non-space character in the string. |
| 220 | */ |
| 221 | |
| 222 | static int same_dline_ignore_allws(DLine *pA, DLine *pB){ |
| 223 | int a = pA->indent, b = pB->indent; |
| 224 | if( pA->h==pB->h ){ |
| 225 | while( a<pA->n && b<pB->n ){ |
| 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | |
| 2189 | */ |
| 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | unsigned c; /* Result color */ |
| 2192 | unsigned x1, x2; |
| 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | x1 = (c1>>16)&0xff; |
| 2195 | x2 = (c2>>16)&0xff; |
| 2196 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2197 | x1 = (c1>>8)&0xff; |
| 2198 | x2 = (c2>>8)&0xff; |
| 2199 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -32,11 +32,10 @@ | |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 38 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| @@ -114,11 +113,11 @@ | |
| 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 114 | DLine *aFrom; /* File on left side of the diff */ |
| 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 116 | DLine *aTo; /* File on right side of the diff */ |
| 117 | int nTo; /* Number of lines in aTo[] */ |
| 118 | int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ |
| 119 | }; |
| 120 | |
| 121 | /* |
| 122 | ** Return an array of DLine objects containing a pointer to the |
| 123 | ** start of each line and a hash of that line. The lower |
| @@ -167,14 +166,15 @@ | |
| 166 | |
| 167 | /* Fill in the array */ |
| 168 | for(i=0; i<nLine; i++){ |
| 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 170 | a[i].z = z; |
| 171 | k = j; |
| 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | } |
| 175 | a[i].n = k; |
| 176 | s = 0; |
| 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | } |
| 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| @@ -207,21 +207,21 @@ | |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Return true if two DLine elements are identical. |
| 211 | */ |
| 212 | static int same_dline(const DLine *pA, const DLine *pB){ |
| 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | ** to the first non-space character in the string. |
| 220 | */ |
| 221 | |
| 222 | static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ |
| 223 | int a = pA->indent, b = pB->indent; |
| 224 | if( pA->h==pB->h ){ |
| 225 | while( a<pA->n && b<pB->n ){ |
| 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| @@ -2189,10 +2189,11 @@ | |
| 2189 | */ |
| 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | unsigned c; /* Result color */ |
| 2192 | unsigned x1, x2; |
| 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | else if(i>=n) return c2; |
| 2195 | x1 = (c1>>16)&0xff; |
| 2196 | x2 = (c2>>16)&0xff; |
| 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2198 | x1 = (c1>>8)&0xff; |
| 2199 | x2 = (c2>>8)&0xff; |
| 2200 |
+4
-7
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -443,24 +443,20 @@ | ||
| 443 | 443 | /* |
| 444 | 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | 445 | ** parameters and the to boolean arguments. |
| 446 | 446 | */ |
| 447 | 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | - u64 diffFlags; | |
| 449 | - if( verboseFlag==0 ){ | |
| 450 | - diffFlags = 0; /* Zero means do not show any diff */ | |
| 451 | - }else{ | |
| 448 | + u64 diffFlags = 0; /* Zero means do not show any diff */ | |
| 449 | + if( verboseFlag!=0 ){ | |
| 452 | 450 | int x; |
| 453 | 451 | if( sideBySide ){ |
| 454 | 452 | diffFlags = DIFF_SIDEBYSIDE; |
| 455 | 453 | |
| 456 | 454 | /* "dw" query parameter determines width of each column */ |
| 457 | 455 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | 456 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | 457 | diffFlags += x; |
| 460 | - }else{ | |
| 461 | - diffFlags = DIFF_INLINE; | |
| 462 | 458 | } |
| 463 | 459 | |
| 464 | 460 | if( P("w") ){ |
| 465 | 461 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 466 | 462 | } |
| @@ -469,12 +465,13 @@ | ||
| 469 | 465 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 470 | 466 | diffFlags += x; |
| 471 | 467 | |
| 472 | 468 | /* The "noopt" parameter disables diff optimization */ |
| 473 | 469 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 470 | + diffFlags |= DIFF_STRIP_EOLCR; | |
| 474 | 471 | } |
| 475 | - return diffFlags|DIFF_STRIP_EOLCR; | |
| 472 | + return diffFlags; | |
| 476 | 473 | } |
| 477 | 474 | |
| 478 | 475 | /* |
| 479 | 476 | ** WEBPAGE: vinfo |
| 480 | 477 | ** WEBPAGE: ci |
| 481 | 478 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -443,24 +443,20 @@ | |
| 443 | /* |
| 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | ** parameters and the to boolean arguments. |
| 446 | */ |
| 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | u64 diffFlags; |
| 449 | if( verboseFlag==0 ){ |
| 450 | diffFlags = 0; /* Zero means do not show any diff */ |
| 451 | }else{ |
| 452 | int x; |
| 453 | if( sideBySide ){ |
| 454 | diffFlags = DIFF_SIDEBYSIDE; |
| 455 | |
| 456 | /* "dw" query parameter determines width of each column */ |
| 457 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | diffFlags += x; |
| 460 | }else{ |
| 461 | diffFlags = DIFF_INLINE; |
| 462 | } |
| 463 | |
| 464 | if( P("w") ){ |
| 465 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 466 | } |
| @@ -469,12 +465,13 @@ | |
| 469 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 470 | diffFlags += x; |
| 471 | |
| 472 | /* The "noopt" parameter disables diff optimization */ |
| 473 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 474 | } |
| 475 | return diffFlags|DIFF_STRIP_EOLCR; |
| 476 | } |
| 477 | |
| 478 | /* |
| 479 | ** WEBPAGE: vinfo |
| 480 | ** WEBPAGE: ci |
| 481 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -443,24 +443,20 @@ | |
| 443 | /* |
| 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | ** parameters and the to boolean arguments. |
| 446 | */ |
| 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | u64 diffFlags = 0; /* Zero means do not show any diff */ |
| 449 | if( verboseFlag!=0 ){ |
| 450 | int x; |
| 451 | if( sideBySide ){ |
| 452 | diffFlags = DIFF_SIDEBYSIDE; |
| 453 | |
| 454 | /* "dw" query parameter determines width of each column */ |
| 455 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 456 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 457 | diffFlags += x; |
| 458 | } |
| 459 | |
| 460 | if( P("w") ){ |
| 461 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 462 | } |
| @@ -469,12 +465,13 @@ | |
| 465 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 466 | diffFlags += x; |
| 467 | |
| 468 | /* The "noopt" parameter disables diff optimization */ |
| 469 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 470 | diffFlags |= DIFF_STRIP_EOLCR; |
| 471 | } |
| 472 | return diffFlags; |
| 473 | } |
| 474 | |
| 475 | /* |
| 476 | ** WEBPAGE: vinfo |
| 477 | ** WEBPAGE: ci |
| 478 |
+1
-1
| --- src/json_wiki.c | ||
| +++ src/json_wiki.c | ||
| @@ -542,11 +542,11 @@ | ||
| 542 | 542 | |
| 543 | 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | 544 | blob_zero(&w2); |
| 545 | 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | 546 | blob_zero(&d); |
| 547 | - diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR | DIFF_INLINE; | |
| 547 | + diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR; | |
| 548 | 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | 549 | blob_reset(&w1); |
| 550 | 550 | blob_reset(&w2); |
| 551 | 551 | |
| 552 | 552 | pay = cson_new_object(); |
| 553 | 553 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -542,11 +542,11 @@ | |
| 542 | |
| 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | blob_zero(&w2); |
| 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | blob_zero(&d); |
| 547 | diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR | DIFF_INLINE; |
| 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | blob_reset(&w1); |
| 550 | blob_reset(&w2); |
| 551 | |
| 552 | pay = cson_new_object(); |
| 553 |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -542,11 +542,11 @@ | |
| 542 | |
| 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | blob_zero(&w2); |
| 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | blob_zero(&d); |
| 547 | diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR; |
| 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | blob_reset(&w1); |
| 550 | blob_reset(&w2); |
| 551 | |
| 552 | pay = cson_new_object(); |
| 553 |
| --- test/merge_renames.test | ||
| +++ test/merge_renames.test | ||
| @@ -1,9 +1,16 @@ | ||
| 1 | 1 | # |
| 2 | 2 | # Tests for merging with renames |
| 3 | 3 | # |
| 4 | 4 | # |
| 5 | + | |
| 6 | +catch {exec $::fossilexe info} res | |
| 7 | +puts res=$res | |
| 8 | +if {![regexp {use --repository} $res]} { | |
| 9 | + puts stderr "Cannot run this test within an open checkout" | |
| 10 | + return | |
| 11 | +} | |
| 5 | 12 | |
| 6 | 13 | ###################################### |
| 7 | 14 | # Test 1 # |
| 8 | 15 | # Reported: Ticket [554f44ee74e3d] # |
| 9 | 16 | ###################################### |
| 10 | 17 |
| --- test/merge_renames.test | |
| +++ test/merge_renames.test | |
| @@ -1,9 +1,16 @@ | |
| 1 | # |
| 2 | # Tests for merging with renames |
| 3 | # |
| 4 | # |
| 5 | |
| 6 | ###################################### |
| 7 | # Test 1 # |
| 8 | # Reported: Ticket [554f44ee74e3d] # |
| 9 | ###################################### |
| 10 |
| --- test/merge_renames.test | |
| +++ test/merge_renames.test | |
| @@ -1,9 +1,16 @@ | |
| 1 | # |
| 2 | # Tests for merging with renames |
| 3 | # |
| 4 | # |
| 5 | |
| 6 | catch {exec $::fossilexe info} res |
| 7 | puts res=$res |
| 8 | if {![regexp {use --repository} $res]} { |
| 9 | puts stderr "Cannot run this test within an open checkout" |
| 10 | return |
| 11 | } |
| 12 | |
| 13 | ###################################### |
| 14 | # Test 1 # |
| 15 | # Reported: Ticket [554f44ee74e3d] # |
| 16 | ###################################### |
| 17 |
+7
| --- test/revert.test | ||
| +++ test/revert.test | ||
| @@ -36,10 +36,17 @@ | ||
| 36 | 36 | test revert-$testid$key $passed |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | fossil undo |
| 40 | 40 | } |
| 41 | + | |
| 42 | +catch {exec $::fossilexe info} res | |
| 43 | +puts res=$res | |
| 44 | +if {![regexp {use --repository} $res]} { | |
| 45 | + puts stderr "Cannot run this test within an open checkout" | |
| 46 | + return | |
| 47 | +} | |
| 41 | 48 | |
| 42 | 49 | repo_init |
| 43 | 50 | |
| 44 | 51 | # Prepare first commit |
| 45 | 52 | # |
| 46 | 53 |
| --- test/revert.test | |
| +++ test/revert.test | |
| @@ -36,10 +36,17 @@ | |
| 36 | test revert-$testid$key $passed |
| 37 | } |
| 38 | |
| 39 | fossil undo |
| 40 | } |
| 41 | |
| 42 | repo_init |
| 43 | |
| 44 | # Prepare first commit |
| 45 | # |
| 46 |
| --- test/revert.test | |
| +++ test/revert.test | |
| @@ -36,10 +36,17 @@ | |
| 36 | test revert-$testid$key $passed |
| 37 | } |
| 38 | |
| 39 | fossil undo |
| 40 | } |
| 41 | |
| 42 | catch {exec $::fossilexe info} res |
| 43 | puts res=$res |
| 44 | if {![regexp {use --repository} $res]} { |
| 45 | puts stderr "Cannot run this test within an open checkout" |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | repo_init |
| 50 | |
| 51 | # Prepare first commit |
| 52 | # |
| 53 |