Index: src/diff.c ================================================================== --- src/diff.c +++ src/diff.c @@ -1996,16 +1996,16 @@ /* ** Initialize the annotation process by specifying the file that is ** to be annotated. The annotator takes control of the input Blob and ** will release it when it is finished with it. */ -static int annotation_start(Annotator *p, Blob *pInput){ +static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ int i; memset(p, 0, sizeof(*p)); p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, - 0); + diffFlags); if( p->c.aTo==0 ){ return 1; } p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); for(i=0; ic.nTo; i++){ @@ -2023,17 +2023,17 @@ ** being annotated. Do another step of the annotation. Return true ** 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, int iVers){ +static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ 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, 0); + &p->c.nFrom, diffFlags); if( p->c.aFrom==0 ){ return 1; } /* Compute the differences going from pParent to the file being @@ -2080,11 +2080,12 @@ static void annotate_file( Annotator *p, /* The annotator */ int fnid, /* The name of the file to be annotated */ int mid, /* Use the version of the file in this check-in */ int iLimit, /* Limit the number of levels if greater than zero */ - int annFlags /* Flags to alter the annotation */ + int annFlags, /* Flags to alter the annotation */ + u64 diffFlags /* Flags to alter the whitespace handling */ ){ Blob toAnnotate; /* Text of the final (mid) version of the file */ Blob step; /* Text of previous revision */ int rid; /* Artifact ID of the file being annotated */ Stmt q; /* Query returning all ancestor versions */ @@ -2098,11 +2099,11 @@ } if( !content_get(rid, &toAnnotate) ){ fossil_fatal("unable to retrieve content of artifact #%d", rid); } if( iLimit<=0 ) iLimit = 1000000000; - annotation_start(p, &toAnnotate); + annotation_start(p, &toAnnotate, diffFlags); db_begin_transaction(); db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" "DELETE FROM vseen;" ); @@ -2132,11 +2133,11 @@ p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); if( p->nVers ){ content_get(rid, &step); - annotation_step(p, &step, p->nVers-1); + annotation_step(p, &step, p->nVers-1, diffFlags); blob_reset(&step); } p->nVers++; db_bind_int(&ins, ":rid", rid); db_step(&ins); @@ -2188,10 +2189,12 @@ int fnid; int i; int iLimit; /* Depth limit */ int annFlags = ANN_FILE_ANCEST; int showLog = 0; /* True to display the log */ + int ignoreWs = 0; /* Ignore whitespace */ + u64 diffFlags = 0; /* diff flags for ignore whitespace */ const char *zFilename; /* Name of file to annotate */ const char *zCI; /* The check-in containing zFilename */ Annotator ann; HQuery url; struct AnnVers *p; @@ -2207,17 +2210,19 @@ zFilename = P("filename"); fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); if( mid==0 || fnid==0 ){ fossil_redirect_home(); } iLimit = atoi(PD("limit","20")); if( P("filevers") ) annFlags |= ANN_FILE_VERS; + ignoreWs = P("w")!=0; + if( ignoreWs ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ fossil_redirect_home(); } /* compute the annotation */ compute_direct_ancestors(mid, 10000000); - annotate_file(&ann, fnid, mid, iLimit, annFlags); + annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); zCI = ann.aVers[0].zMUuid; /* generate the web page */ style_header("Annotation For %h", zFilename); if( bBlame ){ @@ -2229,10 +2234,18 @@ url_add_parameter(&url, "filename", zFilename); if( iLimit!=20 ){ url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); } url_add_parameter(&url, "log", showLog ? "1" : "0"); + if( ignoreWs ){ + url_add_parameter(&url, "w", ""); + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", + "%s", url_render(&url, "w", 0, 0, 0)); + }else{ + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", + "%s", url_render(&url, "w", "", 0, 0)); + } if( showLog ){ style_submenu_element("Hide Log", "Hide Log", "%s", url_render(&url, "log", "0", 0, 0)); }else{ style_submenu_element("Show Log", "Show Log", @@ -2351,13 +2364,16 @@ ** the file was last modified. The "annotate" command shows line numbers ** and omits the username. The "blame" command shows the user who made each ** checkin and omits the line number. ** ** Options: -** --filevers Show file version numbers rather than check-in versions -** -l|--log List all versions analyzed -** -n|--limit N Only look backwards in time by N versions +** --filevers Show file version numbers rather than check-in versions +** -l|--log List all versions analyzed +** -n|--limit N Only look backwards in time by N versions +** --ignore-space-at-eol Ignore eol-whitespaces +** --ignore-space-at-sol Ignore sol-whitespaces +** -w Ignore all whitespaces ** ** See also: info, finfo, timeline */ void annotate_cmd(void){ int fnid; /* Filename ID */ @@ -2369,19 +2385,23 @@ Annotator ann; /* The annotation of the file */ int i; /* Loop counter */ const char *zLimit; /* The value to the -n|--limit option */ int iLimit; /* How far back in time to look */ int showLog; /* True to show the log */ + u64 diffFlags = 0;/* Flags to control whitespace handling */ int fileVers; /* Show file version instead of check-in versions */ int annFlags = 0; /* Flags to control annotation properties */ int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ bBlame = g.argv[1][0]=='b'; zLimit = find_option("limit","n",1); if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; iLimit = atoi(zLimit); showLog = find_option("log","l",0)!=0; + if( find_option("ignore-space-at-sol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_SOLWS; + if( find_option("ignore-space-at-eol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; + if( find_option("w",0,0)!=0 ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); fileVers = find_option("filevers",0,0)!=0; db_must_be_within_tree(); if( g.argc<3 ) { usage("FILENAME"); } @@ -2407,11 +2427,11 @@ fid, fnid); if( mid==0 ){ fossil_fatal("unable to find manifest"); } annFlags |= ANN_FILE_ANCEST; - annotate_file(&ann, fnid, mid, iLimit, annFlags); + annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); if( showLog ){ struct AnnVers *p; for(p=ann.aVers, i=0; izDate, p->zMUuid, p->zFUuid); Index: www/changes.wiki ================================================================== --- www/changes.wiki +++ www/changes.wiki @@ -11,13 +11,16 @@ filter links. * The [/help/info | info command] now shows leaf status of the checkout. * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). * Add option --empty to the "[/help?cmd=open | fossil open]" command. * Enhanced [/help?cmd=/fileage|the fileage page] to support a glob parameter. - * Add --ignore-space-at-sol and --ignore-space-at-eol options to [/help?cmd=diff|fossil (g)diff], - [/help?cmd=stash|fossil stash diff]. The option -w activates both of them. - * Add button "Ignore Whitespace" to /ci, /vdiff and /fdiff UI pages. + * Add --ignore-space-at-sol and --ignore-space-at-eol options to + [/help?cmd=annotate|fossil annotate], [/help?cmd=blame|fossil blame], + [/help?cmd=diff|fossil (g)diff], [/help?cmd=stash|fossil stash diff]. + The option -w activates both of them. + * Add button "Ignore Whitespace" to /annotate, /blame, /ci, /fdiff + and /vdiff UI pages.

Changes For Version 1.28 (2014-01-27)

* Enhance [/help?cmd=/reports | /reports] to support event type filtering. * When cloning a repository, the user name passed via the URL (if any) is now used as the default local admin user's name.