Fossil SCM
Merge in new annotate/blame whitespace buttons with updates to changelog.
Commit
866251e87839a3e0f04685dad742e2a996c34510
Parent
466f8de3c2cd734…
2 files changed
+32
-12
+6
-3
+32
-12
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1996,16 +1996,16 @@ | ||
| 1996 | 1996 | /* |
| 1997 | 1997 | ** Initialize the annotation process by specifying the file that is |
| 1998 | 1998 | ** to be annotated. The annotator takes control of the input Blob and |
| 1999 | 1999 | ** will release it when it is finished with it. |
| 2000 | 2000 | */ |
| 2001 | -static int annotation_start(Annotator *p, Blob *pInput){ | |
| 2001 | +static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ | |
| 2002 | 2002 | int i; |
| 2003 | 2003 | |
| 2004 | 2004 | memset(p, 0, sizeof(*p)); |
| 2005 | 2005 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, |
| 2006 | - 0); | |
| 2006 | + diffFlags); | |
| 2007 | 2007 | if( p->c.aTo==0 ){ |
| 2008 | 2008 | return 1; |
| 2009 | 2009 | } |
| 2010 | 2010 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 2011 | 2011 | for(i=0; i<p->c.nTo; i++){ |
| @@ -2023,17 +2023,17 @@ | ||
| 2023 | 2023 | ** being annotated. Do another step of the annotation. Return true |
| 2024 | 2024 | ** if additional annotation is required. zPName is the tag to insert |
| 2025 | 2025 | ** on each line of the file being annotated that was contributed by |
| 2026 | 2026 | ** pParent. Memory to hold zPName is leaked. |
| 2027 | 2027 | */ |
| 2028 | -static int annotation_step(Annotator *p, Blob *pParent, int iVers){ | |
| 2028 | +static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ | |
| 2029 | 2029 | int i, j; |
| 2030 | 2030 | int lnTo; |
| 2031 | 2031 | |
| 2032 | 2032 | /* Prepare the parent file to be diffed */ |
| 2033 | 2033 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 2034 | - &p->c.nFrom, 0); | |
| 2034 | + &p->c.nFrom, diffFlags); | |
| 2035 | 2035 | if( p->c.aFrom==0 ){ |
| 2036 | 2036 | return 1; |
| 2037 | 2037 | } |
| 2038 | 2038 | |
| 2039 | 2039 | /* Compute the differences going from pParent to the file being |
| @@ -2080,11 +2080,12 @@ | ||
| 2080 | 2080 | static void annotate_file( |
| 2081 | 2081 | Annotator *p, /* The annotator */ |
| 2082 | 2082 | int fnid, /* The name of the file to be annotated */ |
| 2083 | 2083 | int mid, /* Use the version of the file in this check-in */ |
| 2084 | 2084 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2085 | - int annFlags /* Flags to alter the annotation */ | |
| 2085 | + int annFlags, /* Flags to alter the annotation */ | |
| 2086 | + u64 diffFlags /* Flags to alter the whitespace handling */ | |
| 2086 | 2087 | ){ |
| 2087 | 2088 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2088 | 2089 | Blob step; /* Text of previous revision */ |
| 2089 | 2090 | int rid; /* Artifact ID of the file being annotated */ |
| 2090 | 2091 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2099,11 @@ | ||
| 2098 | 2099 | } |
| 2099 | 2100 | if( !content_get(rid, &toAnnotate) ){ |
| 2100 | 2101 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2101 | 2102 | } |
| 2102 | 2103 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2103 | - annotation_start(p, &toAnnotate); | |
| 2104 | + annotation_start(p, &toAnnotate, diffFlags); | |
| 2104 | 2105 | db_begin_transaction(); |
| 2105 | 2106 | db_multi_exec( |
| 2106 | 2107 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2107 | 2108 | "DELETE FROM vseen;" |
| 2108 | 2109 | ); |
| @@ -2132,11 +2133,11 @@ | ||
| 2132 | 2133 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2133 | 2134 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2134 | 2135 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2135 | 2136 | if( p->nVers ){ |
| 2136 | 2137 | content_get(rid, &step); |
| 2137 | - annotation_step(p, &step, p->nVers-1); | |
| 2138 | + annotation_step(p, &step, p->nVers-1, diffFlags); | |
| 2138 | 2139 | blob_reset(&step); |
| 2139 | 2140 | } |
| 2140 | 2141 | p->nVers++; |
| 2141 | 2142 | db_bind_int(&ins, ":rid", rid); |
| 2142 | 2143 | db_step(&ins); |
| @@ -2188,10 +2189,12 @@ | ||
| 2188 | 2189 | int fnid; |
| 2189 | 2190 | int i; |
| 2190 | 2191 | int iLimit; /* Depth limit */ |
| 2191 | 2192 | int annFlags = ANN_FILE_ANCEST; |
| 2192 | 2193 | int showLog = 0; /* True to display the log */ |
| 2194 | + int ignoreWs = 0; /* Ignore whitespace */ | |
| 2195 | + u64 diffFlags = 0; /* diff flags for ignore whitespace */ | |
| 2193 | 2196 | const char *zFilename; /* Name of file to annotate */ |
| 2194 | 2197 | const char *zCI; /* The check-in containing zFilename */ |
| 2195 | 2198 | Annotator ann; |
| 2196 | 2199 | HQuery url; |
| 2197 | 2200 | struct AnnVers *p; |
| @@ -2207,17 +2210,19 @@ | ||
| 2207 | 2210 | zFilename = P("filename"); |
| 2208 | 2211 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2209 | 2212 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2210 | 2213 | iLimit = atoi(PD("limit","20")); |
| 2211 | 2214 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2215 | + ignoreWs = P("w")!=0; | |
| 2216 | + if( ignoreWs ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); | |
| 2212 | 2217 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2213 | 2218 | fossil_redirect_home(); |
| 2214 | 2219 | } |
| 2215 | 2220 | |
| 2216 | 2221 | /* compute the annotation */ |
| 2217 | 2222 | compute_direct_ancestors(mid, 10000000); |
| 2218 | - annotate_file(&ann, fnid, mid, iLimit, annFlags); | |
| 2223 | + annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); | |
| 2219 | 2224 | zCI = ann.aVers[0].zMUuid; |
| 2220 | 2225 | |
| 2221 | 2226 | /* generate the web page */ |
| 2222 | 2227 | style_header("Annotation For %h", zFilename); |
| 2223 | 2228 | if( bBlame ){ |
| @@ -2229,10 +2234,18 @@ | ||
| 2229 | 2234 | url_add_parameter(&url, "filename", zFilename); |
| 2230 | 2235 | if( iLimit!=20 ){ |
| 2231 | 2236 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2232 | 2237 | } |
| 2233 | 2238 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2239 | + if( ignoreWs ){ | |
| 2240 | + url_add_parameter(&url, "w", ""); | |
| 2241 | + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", | |
| 2242 | + "%s", url_render(&url, "w", 0, 0, 0)); | |
| 2243 | + }else{ | |
| 2244 | + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", | |
| 2245 | + "%s", url_render(&url, "w", "", 0, 0)); | |
| 2246 | + } | |
| 2234 | 2247 | if( showLog ){ |
| 2235 | 2248 | style_submenu_element("Hide Log", "Hide Log", |
| 2236 | 2249 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2237 | 2250 | }else{ |
| 2238 | 2251 | style_submenu_element("Show Log", "Show Log", |
| @@ -2351,13 +2364,16 @@ | ||
| 2351 | 2364 | ** the file was last modified. The "annotate" command shows line numbers |
| 2352 | 2365 | ** and omits the username. The "blame" command shows the user who made each |
| 2353 | 2366 | ** checkin and omits the line number. |
| 2354 | 2367 | ** |
| 2355 | 2368 | ** Options: |
| 2356 | -** --filevers Show file version numbers rather than check-in versions | |
| 2357 | -** -l|--log List all versions analyzed | |
| 2358 | -** -n|--limit N Only look backwards in time by N versions | |
| 2369 | +** --filevers Show file version numbers rather than check-in versions | |
| 2370 | +** -l|--log List all versions analyzed | |
| 2371 | +** -n|--limit N Only look backwards in time by N versions | |
| 2372 | +** --ignore-space-at-eol Ignore eol-whitespaces | |
| 2373 | +** --ignore-space-at-sol Ignore sol-whitespaces | |
| 2374 | +** -w Ignore all whitespaces | |
| 2359 | 2375 | ** |
| 2360 | 2376 | ** See also: info, finfo, timeline |
| 2361 | 2377 | */ |
| 2362 | 2378 | void annotate_cmd(void){ |
| 2363 | 2379 | int fnid; /* Filename ID */ |
| @@ -2369,19 +2385,23 @@ | ||
| 2369 | 2385 | Annotator ann; /* The annotation of the file */ |
| 2370 | 2386 | int i; /* Loop counter */ |
| 2371 | 2387 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2372 | 2388 | int iLimit; /* How far back in time to look */ |
| 2373 | 2389 | int showLog; /* True to show the log */ |
| 2390 | + u64 diffFlags = 0;/* Flags to control whitespace handling */ | |
| 2374 | 2391 | int fileVers; /* Show file version instead of check-in versions */ |
| 2375 | 2392 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2376 | 2393 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2377 | 2394 | |
| 2378 | 2395 | bBlame = g.argv[1][0]=='b'; |
| 2379 | 2396 | zLimit = find_option("limit","n",1); |
| 2380 | 2397 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2381 | 2398 | iLimit = atoi(zLimit); |
| 2382 | 2399 | showLog = find_option("log","l",0)!=0; |
| 2400 | + if( find_option("ignore-space-at-sol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_SOLWS; | |
| 2401 | + if( find_option("ignore-space-at-eol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; | |
| 2402 | + if( find_option("w",0,0)!=0 ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); | |
| 2383 | 2403 | fileVers = find_option("filevers",0,0)!=0; |
| 2384 | 2404 | db_must_be_within_tree(); |
| 2385 | 2405 | if( g.argc<3 ) { |
| 2386 | 2406 | usage("FILENAME"); |
| 2387 | 2407 | } |
| @@ -2407,11 +2427,11 @@ | ||
| 2407 | 2427 | fid, fnid); |
| 2408 | 2428 | if( mid==0 ){ |
| 2409 | 2429 | fossil_fatal("unable to find manifest"); |
| 2410 | 2430 | } |
| 2411 | 2431 | annFlags |= ANN_FILE_ANCEST; |
| 2412 | - annotate_file(&ann, fnid, mid, iLimit, annFlags); | |
| 2432 | + annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); | |
| 2413 | 2433 | if( showLog ){ |
| 2414 | 2434 | struct AnnVers *p; |
| 2415 | 2435 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2416 | 2436 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2417 | 2437 | i+1, p->zDate, p->zMUuid, p->zFUuid); |
| 2418 | 2438 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1996,16 +1996,16 @@ | |
| 1996 | /* |
| 1997 | ** Initialize the annotation process by specifying the file that is |
| 1998 | ** to be annotated. The annotator takes control of the input Blob and |
| 1999 | ** will release it when it is finished with it. |
| 2000 | */ |
| 2001 | static int annotation_start(Annotator *p, Blob *pInput){ |
| 2002 | int i; |
| 2003 | |
| 2004 | memset(p, 0, sizeof(*p)); |
| 2005 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, |
| 2006 | 0); |
| 2007 | if( p->c.aTo==0 ){ |
| 2008 | return 1; |
| 2009 | } |
| 2010 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 2011 | for(i=0; i<p->c.nTo; i++){ |
| @@ -2023,17 +2023,17 @@ | |
| 2023 | ** being annotated. Do another step of the annotation. Return true |
| 2024 | ** if additional annotation is required. zPName is the tag to insert |
| 2025 | ** on each line of the file being annotated that was contributed by |
| 2026 | ** pParent. Memory to hold zPName is leaked. |
| 2027 | */ |
| 2028 | static int annotation_step(Annotator *p, Blob *pParent, int iVers){ |
| 2029 | int i, j; |
| 2030 | int lnTo; |
| 2031 | |
| 2032 | /* Prepare the parent file to be diffed */ |
| 2033 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 2034 | &p->c.nFrom, 0); |
| 2035 | if( p->c.aFrom==0 ){ |
| 2036 | return 1; |
| 2037 | } |
| 2038 | |
| 2039 | /* Compute the differences going from pParent to the file being |
| @@ -2080,11 +2080,12 @@ | |
| 2080 | static void annotate_file( |
| 2081 | Annotator *p, /* The annotator */ |
| 2082 | int fnid, /* The name of the file to be annotated */ |
| 2083 | int mid, /* Use the version of the file in this check-in */ |
| 2084 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2085 | int annFlags /* Flags to alter the annotation */ |
| 2086 | ){ |
| 2087 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2088 | Blob step; /* Text of previous revision */ |
| 2089 | int rid; /* Artifact ID of the file being annotated */ |
| 2090 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2099,11 @@ | |
| 2098 | } |
| 2099 | if( !content_get(rid, &toAnnotate) ){ |
| 2100 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2101 | } |
| 2102 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2103 | annotation_start(p, &toAnnotate); |
| 2104 | db_begin_transaction(); |
| 2105 | db_multi_exec( |
| 2106 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2107 | "DELETE FROM vseen;" |
| 2108 | ); |
| @@ -2132,11 +2133,11 @@ | |
| 2132 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2133 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2134 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2135 | if( p->nVers ){ |
| 2136 | content_get(rid, &step); |
| 2137 | annotation_step(p, &step, p->nVers-1); |
| 2138 | blob_reset(&step); |
| 2139 | } |
| 2140 | p->nVers++; |
| 2141 | db_bind_int(&ins, ":rid", rid); |
| 2142 | db_step(&ins); |
| @@ -2188,10 +2189,12 @@ | |
| 2188 | int fnid; |
| 2189 | int i; |
| 2190 | int iLimit; /* Depth limit */ |
| 2191 | int annFlags = ANN_FILE_ANCEST; |
| 2192 | int showLog = 0; /* True to display the log */ |
| 2193 | const char *zFilename; /* Name of file to annotate */ |
| 2194 | const char *zCI; /* The check-in containing zFilename */ |
| 2195 | Annotator ann; |
| 2196 | HQuery url; |
| 2197 | struct AnnVers *p; |
| @@ -2207,17 +2210,19 @@ | |
| 2207 | zFilename = P("filename"); |
| 2208 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2209 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2210 | iLimit = atoi(PD("limit","20")); |
| 2211 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2212 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2213 | fossil_redirect_home(); |
| 2214 | } |
| 2215 | |
| 2216 | /* compute the annotation */ |
| 2217 | compute_direct_ancestors(mid, 10000000); |
| 2218 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2219 | zCI = ann.aVers[0].zMUuid; |
| 2220 | |
| 2221 | /* generate the web page */ |
| 2222 | style_header("Annotation For %h", zFilename); |
| 2223 | if( bBlame ){ |
| @@ -2229,10 +2234,18 @@ | |
| 2229 | url_add_parameter(&url, "filename", zFilename); |
| 2230 | if( iLimit!=20 ){ |
| 2231 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2232 | } |
| 2233 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2234 | if( showLog ){ |
| 2235 | style_submenu_element("Hide Log", "Hide Log", |
| 2236 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2237 | }else{ |
| 2238 | style_submenu_element("Show Log", "Show Log", |
| @@ -2351,13 +2364,16 @@ | |
| 2351 | ** the file was last modified. The "annotate" command shows line numbers |
| 2352 | ** and omits the username. The "blame" command shows the user who made each |
| 2353 | ** checkin and omits the line number. |
| 2354 | ** |
| 2355 | ** Options: |
| 2356 | ** --filevers Show file version numbers rather than check-in versions |
| 2357 | ** -l|--log List all versions analyzed |
| 2358 | ** -n|--limit N Only look backwards in time by N versions |
| 2359 | ** |
| 2360 | ** See also: info, finfo, timeline |
| 2361 | */ |
| 2362 | void annotate_cmd(void){ |
| 2363 | int fnid; /* Filename ID */ |
| @@ -2369,19 +2385,23 @@ | |
| 2369 | Annotator ann; /* The annotation of the file */ |
| 2370 | int i; /* Loop counter */ |
| 2371 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2372 | int iLimit; /* How far back in time to look */ |
| 2373 | int showLog; /* True to show the log */ |
| 2374 | int fileVers; /* Show file version instead of check-in versions */ |
| 2375 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2376 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2377 | |
| 2378 | bBlame = g.argv[1][0]=='b'; |
| 2379 | zLimit = find_option("limit","n",1); |
| 2380 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2381 | iLimit = atoi(zLimit); |
| 2382 | showLog = find_option("log","l",0)!=0; |
| 2383 | fileVers = find_option("filevers",0,0)!=0; |
| 2384 | db_must_be_within_tree(); |
| 2385 | if( g.argc<3 ) { |
| 2386 | usage("FILENAME"); |
| 2387 | } |
| @@ -2407,11 +2427,11 @@ | |
| 2407 | fid, fnid); |
| 2408 | if( mid==0 ){ |
| 2409 | fossil_fatal("unable to find manifest"); |
| 2410 | } |
| 2411 | annFlags |= ANN_FILE_ANCEST; |
| 2412 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2413 | if( showLog ){ |
| 2414 | struct AnnVers *p; |
| 2415 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2416 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2417 | i+1, p->zDate, p->zMUuid, p->zFUuid); |
| 2418 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1996,16 +1996,16 @@ | |
| 1996 | /* |
| 1997 | ** Initialize the annotation process by specifying the file that is |
| 1998 | ** to be annotated. The annotator takes control of the input Blob and |
| 1999 | ** will release it when it is finished with it. |
| 2000 | */ |
| 2001 | static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ |
| 2002 | int i; |
| 2003 | |
| 2004 | memset(p, 0, sizeof(*p)); |
| 2005 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, |
| 2006 | diffFlags); |
| 2007 | if( p->c.aTo==0 ){ |
| 2008 | return 1; |
| 2009 | } |
| 2010 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 2011 | for(i=0; i<p->c.nTo; i++){ |
| @@ -2023,17 +2023,17 @@ | |
| 2023 | ** being annotated. Do another step of the annotation. Return true |
| 2024 | ** if additional annotation is required. zPName is the tag to insert |
| 2025 | ** on each line of the file being annotated that was contributed by |
| 2026 | ** pParent. Memory to hold zPName is leaked. |
| 2027 | */ |
| 2028 | static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ |
| 2029 | int i, j; |
| 2030 | int lnTo; |
| 2031 | |
| 2032 | /* Prepare the parent file to be diffed */ |
| 2033 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 2034 | &p->c.nFrom, diffFlags); |
| 2035 | if( p->c.aFrom==0 ){ |
| 2036 | return 1; |
| 2037 | } |
| 2038 | |
| 2039 | /* Compute the differences going from pParent to the file being |
| @@ -2080,11 +2080,12 @@ | |
| 2080 | static void annotate_file( |
| 2081 | Annotator *p, /* The annotator */ |
| 2082 | int fnid, /* The name of the file to be annotated */ |
| 2083 | int mid, /* Use the version of the file in this check-in */ |
| 2084 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2085 | int annFlags, /* Flags to alter the annotation */ |
| 2086 | u64 diffFlags /* Flags to alter the whitespace handling */ |
| 2087 | ){ |
| 2088 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2089 | Blob step; /* Text of previous revision */ |
| 2090 | int rid; /* Artifact ID of the file being annotated */ |
| 2091 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2099,11 @@ | |
| 2099 | } |
| 2100 | if( !content_get(rid, &toAnnotate) ){ |
| 2101 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2102 | } |
| 2103 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2104 | annotation_start(p, &toAnnotate, diffFlags); |
| 2105 | db_begin_transaction(); |
| 2106 | db_multi_exec( |
| 2107 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2108 | "DELETE FROM vseen;" |
| 2109 | ); |
| @@ -2132,11 +2133,11 @@ | |
| 2133 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2134 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2135 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2136 | if( p->nVers ){ |
| 2137 | content_get(rid, &step); |
| 2138 | annotation_step(p, &step, p->nVers-1, diffFlags); |
| 2139 | blob_reset(&step); |
| 2140 | } |
| 2141 | p->nVers++; |
| 2142 | db_bind_int(&ins, ":rid", rid); |
| 2143 | db_step(&ins); |
| @@ -2188,10 +2189,12 @@ | |
| 2189 | int fnid; |
| 2190 | int i; |
| 2191 | int iLimit; /* Depth limit */ |
| 2192 | int annFlags = ANN_FILE_ANCEST; |
| 2193 | int showLog = 0; /* True to display the log */ |
| 2194 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2195 | u64 diffFlags = 0; /* diff flags for ignore whitespace */ |
| 2196 | const char *zFilename; /* Name of file to annotate */ |
| 2197 | const char *zCI; /* The check-in containing zFilename */ |
| 2198 | Annotator ann; |
| 2199 | HQuery url; |
| 2200 | struct AnnVers *p; |
| @@ -2207,17 +2210,19 @@ | |
| 2210 | zFilename = P("filename"); |
| 2211 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2212 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2213 | iLimit = atoi(PD("limit","20")); |
| 2214 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2215 | ignoreWs = P("w")!=0; |
| 2216 | if( ignoreWs ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); |
| 2217 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2218 | fossil_redirect_home(); |
| 2219 | } |
| 2220 | |
| 2221 | /* compute the annotation */ |
| 2222 | compute_direct_ancestors(mid, 10000000); |
| 2223 | annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); |
| 2224 | zCI = ann.aVers[0].zMUuid; |
| 2225 | |
| 2226 | /* generate the web page */ |
| 2227 | style_header("Annotation For %h", zFilename); |
| 2228 | if( bBlame ){ |
| @@ -2229,10 +2234,18 @@ | |
| 2234 | url_add_parameter(&url, "filename", zFilename); |
| 2235 | if( iLimit!=20 ){ |
| 2236 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2237 | } |
| 2238 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2239 | if( ignoreWs ){ |
| 2240 | url_add_parameter(&url, "w", ""); |
| 2241 | style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", |
| 2242 | "%s", url_render(&url, "w", 0, 0, 0)); |
| 2243 | }else{ |
| 2244 | style_submenu_element("Ignore Whitespace", "Ignore Whitespace", |
| 2245 | "%s", url_render(&url, "w", "", 0, 0)); |
| 2246 | } |
| 2247 | if( showLog ){ |
| 2248 | style_submenu_element("Hide Log", "Hide Log", |
| 2249 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2250 | }else{ |
| 2251 | style_submenu_element("Show Log", "Show Log", |
| @@ -2351,13 +2364,16 @@ | |
| 2364 | ** the file was last modified. The "annotate" command shows line numbers |
| 2365 | ** and omits the username. The "blame" command shows the user who made each |
| 2366 | ** checkin and omits the line number. |
| 2367 | ** |
| 2368 | ** Options: |
| 2369 | ** --filevers Show file version numbers rather than check-in versions |
| 2370 | ** -l|--log List all versions analyzed |
| 2371 | ** -n|--limit N Only look backwards in time by N versions |
| 2372 | ** --ignore-space-at-eol Ignore eol-whitespaces |
| 2373 | ** --ignore-space-at-sol Ignore sol-whitespaces |
| 2374 | ** -w Ignore all whitespaces |
| 2375 | ** |
| 2376 | ** See also: info, finfo, timeline |
| 2377 | */ |
| 2378 | void annotate_cmd(void){ |
| 2379 | int fnid; /* Filename ID */ |
| @@ -2369,19 +2385,23 @@ | |
| 2385 | Annotator ann; /* The annotation of the file */ |
| 2386 | int i; /* Loop counter */ |
| 2387 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2388 | int iLimit; /* How far back in time to look */ |
| 2389 | int showLog; /* True to show the log */ |
| 2390 | u64 diffFlags = 0;/* Flags to control whitespace handling */ |
| 2391 | int fileVers; /* Show file version instead of check-in versions */ |
| 2392 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2393 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2394 | |
| 2395 | bBlame = g.argv[1][0]=='b'; |
| 2396 | zLimit = find_option("limit","n",1); |
| 2397 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2398 | iLimit = atoi(zLimit); |
| 2399 | showLog = find_option("log","l",0)!=0; |
| 2400 | if( find_option("ignore-space-at-sol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_SOLWS; |
| 2401 | if( find_option("ignore-space-at-eol",0,0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; |
| 2402 | if( find_option("w",0,0)!=0 ) diffFlags |= (DIFF_IGNORE_EOLWS|DIFF_IGNORE_SOLWS); |
| 2403 | fileVers = find_option("filevers",0,0)!=0; |
| 2404 | db_must_be_within_tree(); |
| 2405 | if( g.argc<3 ) { |
| 2406 | usage("FILENAME"); |
| 2407 | } |
| @@ -2407,11 +2427,11 @@ | |
| 2427 | fid, fnid); |
| 2428 | if( mid==0 ){ |
| 2429 | fossil_fatal("unable to find manifest"); |
| 2430 | } |
| 2431 | annFlags |= ANN_FILE_ANCEST; |
| 2432 | annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); |
| 2433 | if( showLog ){ |
| 2434 | struct AnnVers *p; |
| 2435 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2436 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2437 | i+1, p->zDate, p->zMUuid, p->zFUuid); |
| 2438 |
+6
-3
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -11,13 +11,16 @@ | ||
| 11 | 11 | filter links. |
| 12 | 12 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 13 | 13 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 14 | 14 | * Add option --empty to the "[/help?cmd=open | fossil open]" command. |
| 15 | 15 | * Enhanced [/help?cmd=/fileage|the fileage page] to support a glob parameter. |
| 16 | - * Add --ignore-space-at-sol and --ignore-space-at-eol options to [/help?cmd=diff|fossil (g)diff], | |
| 17 | - [/help?cmd=stash|fossil stash diff]. The option -w activates both of them. | |
| 18 | - * Add button "Ignore Whitespace" to /ci, /vdiff and /fdiff UI pages. | |
| 16 | + * Add --ignore-space-at-sol and --ignore-space-at-eol options to | |
| 17 | + [/help?cmd=annotate|fossil annotate], [/help?cmd=blame|fossil blame], | |
| 18 | + [/help?cmd=diff|fossil (g)diff], [/help?cmd=stash|fossil stash diff]. | |
| 19 | + The option -w activates both of them. | |
| 20 | + * Add button "Ignore Whitespace" to /annotate, /blame, /ci, /fdiff | |
| 21 | + and /vdiff UI pages. | |
| 19 | 22 | |
| 20 | 23 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 21 | 24 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 22 | 25 | * When cloning a repository, the user name passed via the URL (if any) |
| 23 | 26 | is now used as the default local admin user's name. |
| 24 | 27 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -11,13 +11,16 @@ | |
| 11 | filter links. |
| 12 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 13 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 14 | * Add option --empty to the "[/help?cmd=open | fossil open]" command. |
| 15 | * Enhanced [/help?cmd=/fileage|the fileage page] to support a glob parameter. |
| 16 | * Add --ignore-space-at-sol and --ignore-space-at-eol options to [/help?cmd=diff|fossil (g)diff], |
| 17 | [/help?cmd=stash|fossil stash diff]. The option -w activates both of them. |
| 18 | * Add button "Ignore Whitespace" to /ci, /vdiff and /fdiff UI pages. |
| 19 | |
| 20 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 21 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 22 | * When cloning a repository, the user name passed via the URL (if any) |
| 23 | is now used as the default local admin user's name. |
| 24 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -11,13 +11,16 @@ | |
| 11 | filter links. |
| 12 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 13 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 14 | * Add option --empty to the "[/help?cmd=open | fossil open]" command. |
| 15 | * Enhanced [/help?cmd=/fileage|the fileage page] to support a glob parameter. |
| 16 | * Add --ignore-space-at-sol and --ignore-space-at-eol options to |
| 17 | [/help?cmd=annotate|fossil annotate], [/help?cmd=blame|fossil blame], |
| 18 | [/help?cmd=diff|fossil (g)diff], [/help?cmd=stash|fossil stash diff]. |
| 19 | The option -w activates both of them. |
| 20 | * Add button "Ignore Whitespace" to /annotate, /blame, /ci, /fdiff |
| 21 | and /vdiff UI pages. |
| 22 | |
| 23 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 24 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 25 | * When cloning a repository, the user name passed via the URL (if any) |
| 26 | is now used as the default local admin user's name. |
| 27 |