Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improvements to the annotation algorithm so that if a line changes from X to Y then back to X, the annotation shows the second X not the first. Ticket [f0f9aff371f26] |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
73c38a3add8f0c3261f1ff5d1bc5d9b3 |
| User & Date: | drh 2011-05-06 16:32:05.872 |
Context
|
2011-05-06
| ||
| 16:44 | Show the artifact numbers on the From and To of a file diff. ... (check-in: 9a63d1f048 user: drh tags: trunk) | |
| 16:32 | Improvements to the annotation algorithm so that if a line changes from X to Y then back to X, the annotation shows the second X not the first. Ticket [f0f9aff371f26] ... (check-in: 73c38a3add user: drh tags: trunk) | |
| 14:36 | Add --limit and --log options to the "annotate" command and corresponding query parameters to the web annotation interface. Part of the investigation of ticket [f0f9aff371f26b4] ... (check-in: bd36723c3d user: drh tags: trunk) | |
Changes
Changes to src/diff.c.
| ︙ | ︙ | |||
624 625 626 627 628 629 630 |
/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;
struct Annotator {
DContext c; /* The diff-engine context */
| | | > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;
struct Annotator {
DContext c; /* The diff-engine context */
struct AnnLine { /* Lines of the original files... */
const char *z; /* The text of the line */
short int n; /* Number of bytes (omitting trailing space and \n) */
short int iLevel; /* Level at which tag was set */
const char *zSrc; /* Tag showing origin of this line */
} *aOrig;
int nOrig; /* Number of elements in aOrig[] */
int nNoSrc; /* Number of entries where aOrig[].zSrc==NULL */
int iLevel; /* Current level */
int nVers; /* Number of versions analyzed */
char **azVers; /* Names of versions analyzed */
};
/*
** Initialize the annotation process by specifying the file that is
** to be annotated. The annotator takes control of the input Blob and
|
| ︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
** if additional annotation is required. zPName is the tag to insert
** on each line of the file being annotated that was contributed by
** pParent. Memory to hold zPName is leaked.
*/
static int annotation_step(Annotator *p, Blob *pParent, char *zPName){
int i, j;
int lnTo;
/* Prepare the parent file to be diffed */
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
&p->c.nFrom, 1);
if( p->c.aFrom==0 ){
return 1;
}
/* Compute the differences going from pParent to the file being
** annotated. */
diff_all(&p->c);
/* Where new lines are inserted on this difference, record the
** zPName as the source of the new line.
*/
for(i=lnTo=0; i<p->c.nEdit; i+=3){
| > > > > > > | > | > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
** if additional annotation is required. zPName is the tag to insert
** on each line of the file being annotated that was contributed by
** pParent. Memory to hold zPName is leaked.
*/
static int annotation_step(Annotator *p, Blob *pParent, char *zPName){
int i, j;
int lnTo;
int iPrevLevel;
int iThisLevel;
/* Prepare the parent file to be diffed */
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
&p->c.nFrom, 1);
if( p->c.aFrom==0 ){
return 1;
}
/* Compute the differences going from pParent to the file being
** annotated. */
diff_all(&p->c);
/* Where new lines are inserted on this difference, record the
** zPName as the source of the new line.
*/
iPrevLevel = p->iLevel;
p->iLevel++;
iThisLevel = p->iLevel;
for(i=lnTo=0; i<p->c.nEdit; i+=3){
struct AnnLine *x = &p->aOrig[lnTo];
for(j=0; j<p->c.aEdit[i]; j++, lnTo++, x++){
if( x->zSrc==0 || x->iLevel==iPrevLevel ){
x->zSrc = zPName;
x->iLevel = iThisLevel;
}
}
lnTo += p->c.aEdit[i+2];
}
/* Clear out the diff results */
free(p->c.aEdit);
p->c.aEdit = 0;
|
| ︙ | ︙ |