Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Enhanced comments in the diff.c source code file. No code changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a39a992b4e02a92ff85a1173bfa0ff1d |
| User & Date: | drh 2012-12-17 14:00:44.940 |
Context
|
2012-12-18
| ||
| 02:38 | Fix the display of file renames so that they show up as just renames and do not also appear as a delete. ... (check-in: ebd36f9b2b user: drh tags: trunk) | |
| 01:39 | When a file is renamed, do not show it has having been deleted in addition to being renamed. After upgrading through this change, you must run "fossil rebuild" for the fix to take effect. ... (check-in: 4ac43fe6e3 user: drh tags: improved-name-change-display) | |
|
2012-12-17
| ||
| 14:00 | Enhanced comments in the diff.c source code file. No code changes. ... (check-in: a39a992b4e user: drh tags: trunk) | |
| 00:38 | Change the footer in the 'Enhanced Default' skin to show the approximate time needed to generated the HTML for the page. ... (check-in: 0c6e645175 user: mistachkin tags: trunk) | |
Changes
Changes to src/diff.c.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | #include "config.h" #include "diff.h" #include <assert.h> #if INTERFACE /* | | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include "config.h" #include "diff.h" #include <assert.h> #if INTERFACE /* ** Flag parameters to the text_diff() routine used to control the formatting ** of the diff output. */ #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */ #define DIFF_NEWFILE ((u64)0x04000000) /* Missing shown as empty files */ #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */ |
| ︙ | ︙ | |||
50 51 52 53 54 55 56 |
#define DIFF_CANNOT_COMPUTE_SYMLINK \
"cannot compute difference between symlink and regular file\n"
#define looks_like_binary(blob) (looks_like_utf8((blob)) == 0)
#endif /* INTERFACE */
/*
| | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
#define DIFF_CANNOT_COMPUTE_SYMLINK \
"cannot compute difference between symlink and regular file\n"
#define looks_like_binary(blob) (looks_like_utf8((blob)) == 0)
#endif /* INTERFACE */
/*
** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes)
*/
#define LENGTH_MASK_SZ 13
#define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1)
/*
** Information about each line of a file being diffed.
**
|
| ︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
**
** Trailing whitespace is removed from each line. 2010-08-20: Not any
** more. If trailing whitespace is ignored, the "patch" command gets
** confused by the diff output. Ticket [a9f7b23c2e376af5b0e5b]
**
** Return 0 if the file is binary or contains a line that is
** too long.
*/
static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){
int nLine, i, j, k, x;
unsigned int h, h2;
DLine *a;
/* Count the number of lines. Allocate space to hold
| > > > | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
**
** Trailing whitespace is removed from each line. 2010-08-20: Not any
** more. If trailing whitespace is ignored, the "patch" command gets
** confused by the diff output. Ticket [a9f7b23c2e376af5b0e5b]
**
** Return 0 if the file is binary or contains a line that is
** too long.
**
** Profiling show that in most cases this routine consumes the bulk of
** the CPU time on a diff.
*/
static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){
int nLine, i, j, k, x;
unsigned int h, h2;
DLine *a;
/* Count the number of lines. Allocate space to hold
|
| ︙ | ︙ | |||
437 438 439 440 441 442 443 |
blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
}
blob_append(pOut, "\n", 1);
}
/*
** Add two line numbers to the beginning of an output line for a context
| | | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
}
blob_append(pOut, "\n", 1);
}
/*
** Add two line numbers to the beginning of an output line for a context
** diff. One or the other of the two numbers might be zero, which means
** to leave that number field blank. The "html" parameter means to format
** the output for HTML.
*/
static void appendDiffLineno(Blob *pOut, int lnA, int lnB, int html){
if( html ) blob_append(pOut, "<span class=\"diffln\">", -1);
if( lnA>0 ){
blob_appendf(pOut, "%6d ", lnA);
|
| ︙ | ︙ | |||
519 520 521 522 523 524 525 |
}
for(i=1; i<nr; i++){
na += R[r+i*3];
nb += R[r+i*3];
}
/* Show the header for this block, or if we are doing a modified
| | | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
}
for(i=1; i<nr; i++){
na += R[r+i*3];
nb += R[r+i*3];
}
/* Show the header for this block, or if we are doing a modified
** context diff that contains line numbers, show the separator from
** the previous block.
*/
nChunk++;
if( showLn ){
if( r==0 ){
/* Do not show a top divider */
}else if( html ){
|
| ︙ | ︙ |