Fossil SCM
Since Annotation flags and DIFF flags are so closely related, allow then to reside in a single variable
Commit
0bc584fe020fc430d122154fa5ab749c5b7759a6
Parent
dd47a123e1fd99d…
1 file changed
+13
-16
+13
-16
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2064,13 +2064,13 @@ | ||
| 2064 | 2064 | /* Return no errors */ |
| 2065 | 2065 | return 0; |
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | 2068 | |
| 2069 | -/* Annotation flags */ | |
| 2070 | -#define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ | |
| 2071 | -#define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ | |
| 2069 | +/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ | |
| 2070 | +#define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ | |
| 2071 | +#define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ | |
| 2072 | 2072 | |
| 2073 | 2073 | /* |
| 2074 | 2074 | ** Compute a complete annotation on a file. The file is identified |
| 2075 | 2075 | ** by its filename number (filename.fnid) and the baseline in which |
| 2076 | 2076 | ** it was checked in (mlink.mid). |
| @@ -2078,12 +2078,11 @@ | ||
| 2078 | 2078 | static void annotate_file( |
| 2079 | 2079 | Annotator *p, /* The annotator */ |
| 2080 | 2080 | int fnid, /* The name of the file to be annotated */ |
| 2081 | 2081 | int mid, /* Use the version of the file in this check-in */ |
| 2082 | 2082 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2083 | - int annFlags, /* Flags to alter the annotation */ | |
| 2084 | - u64 diffFlags /* Flags to alter the whitespace handling */ | |
| 2083 | + u64 annFlags /* Flags to alter the annotation */ | |
| 2085 | 2084 | ){ |
| 2086 | 2085 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2087 | 2086 | Blob step; /* Text of previous revision */ |
| 2088 | 2087 | int rid; /* Artifact ID of the file being annotated */ |
| 2089 | 2088 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2097,11 @@ | ||
| 2098 | 2097 | if( !content_get(rid, &toAnnotate) ){ |
| 2099 | 2098 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2100 | 2099 | } |
| 2101 | 2100 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2102 | 2101 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2103 | - annotation_start(p, &toAnnotate, diffFlags); | |
| 2102 | + annotation_start(p, &toAnnotate, annFlags); | |
| 2104 | 2103 | db_begin_transaction(); |
| 2105 | 2104 | db_multi_exec( |
| 2106 | 2105 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2107 | 2106 | "DELETE FROM vseen;" |
| 2108 | 2107 | ); |
| @@ -2133,11 +2132,11 @@ | ||
| 2133 | 2132 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2134 | 2133 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2135 | 2134 | if( p->nVers ){ |
| 2136 | 2135 | content_get(rid, &step); |
| 2137 | 2136 | blob_to_utf8_no_bom(&step, 0); |
| 2138 | - annotation_step(p, &step, p->nVers-1, diffFlags); | |
| 2137 | + annotation_step(p, &step, p->nVers-1, annFlags); | |
| 2139 | 2138 | blob_reset(&step); |
| 2140 | 2139 | } |
| 2141 | 2140 | p->nVers++; |
| 2142 | 2141 | db_bind_int(&ins, ":rid", rid); |
| 2143 | 2142 | db_step(&ins); |
| @@ -2188,14 +2187,13 @@ | ||
| 2188 | 2187 | void annotation_page(void){ |
| 2189 | 2188 | int mid; |
| 2190 | 2189 | int fnid; |
| 2191 | 2190 | int i; |
| 2192 | 2191 | int iLimit; /* Depth limit */ |
| 2193 | - int annFlags = ANN_FILE_ANCEST; | |
| 2192 | + u64 annFlags = ANN_FILE_ANCEST; | |
| 2194 | 2193 | int showLog = 0; /* True to display the log */ |
| 2195 | 2194 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2196 | - u64 diffFlags = 0; /* diff flags for ignore whitespace */ | |
| 2197 | 2195 | const char *zFilename; /* Name of file to annotate */ |
| 2198 | 2196 | const char *zCI; /* The check-in containing zFilename */ |
| 2199 | 2197 | Annotator ann; |
| 2200 | 2198 | HQuery url; |
| 2201 | 2199 | struct AnnVers *p; |
| @@ -2212,18 +2210,18 @@ | ||
| 2212 | 2210 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2213 | 2211 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2214 | 2212 | iLimit = atoi(PD("limit","20")); |
| 2215 | 2213 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2216 | 2214 | ignoreWs = P("w")!=0; |
| 2217 | - if( ignoreWs ) diffFlags |= DIFF_IGNORE_ALLWS; | |
| 2215 | + if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; | |
| 2218 | 2216 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2219 | 2217 | fossil_redirect_home(); |
| 2220 | 2218 | } |
| 2221 | 2219 | |
| 2222 | 2220 | /* compute the annotation */ |
| 2223 | 2221 | compute_direct_ancestors(mid, 10000000); |
| 2224 | - annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); | |
| 2222 | + annotate_file(&ann, fnid, mid, iLimit, annFlags); | |
| 2225 | 2223 | zCI = ann.aVers[0].zMUuid; |
| 2226 | 2224 | |
| 2227 | 2225 | /* generate the web page */ |
| 2228 | 2226 | style_header("Annotation For %h", zFilename); |
| 2229 | 2227 | if( bBlame ){ |
| @@ -2386,22 +2384,21 @@ | ||
| 2386 | 2384 | Annotator ann; /* The annotation of the file */ |
| 2387 | 2385 | int i; /* Loop counter */ |
| 2388 | 2386 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2389 | 2387 | int iLimit; /* How far back in time to look */ |
| 2390 | 2388 | int showLog; /* True to show the log */ |
| 2391 | - u64 diffFlags = 0;/* Flags to control whitespace handling */ | |
| 2392 | 2389 | int fileVers; /* Show file version instead of check-in versions */ |
| 2393 | - int annFlags = 0; /* Flags to control annotation properties */ | |
| 2390 | + u64 annFlags = 0; /* Flags to control annotation properties */ | |
| 2394 | 2391 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2395 | 2392 | |
| 2396 | 2393 | bBlame = g.argv[1][0]!='a'; |
| 2397 | 2394 | zLimit = find_option("limit","n",1); |
| 2398 | 2395 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2399 | 2396 | iLimit = atoi(zLimit); |
| 2400 | 2397 | showLog = find_option("log","l",0)!=0; |
| 2401 | - if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; | |
| 2402 | - if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS; | |
| 2398 | + if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS; | |
| 2399 | + if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS; | |
| 2403 | 2400 | fileVers = find_option("filevers",0,0)!=0; |
| 2404 | 2401 | db_must_be_within_tree(); |
| 2405 | 2402 | if( g.argc<3 ) { |
| 2406 | 2403 | usage("FILENAME"); |
| 2407 | 2404 | } |
| @@ -2427,11 +2424,11 @@ | ||
| 2427 | 2424 | fid, fnid); |
| 2428 | 2425 | if( mid==0 ){ |
| 2429 | 2426 | fossil_fatal("unable to find manifest"); |
| 2430 | 2427 | } |
| 2431 | 2428 | annFlags |= ANN_FILE_ANCEST; |
| 2432 | - annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); | |
| 2429 | + annotate_file(&ann, fnid, mid, iLimit, annFlags); | |
| 2433 | 2430 | if( showLog ){ |
| 2434 | 2431 | struct AnnVers *p; |
| 2435 | 2432 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2436 | 2433 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2437 | 2434 | i+1, p->zDate, p->zMUuid, p->zFUuid); |
| 2438 | 2435 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2064,13 +2064,13 @@ | |
| 2064 | /* Return no errors */ |
| 2065 | return 0; |
| 2066 | } |
| 2067 | |
| 2068 | |
| 2069 | /* Annotation flags */ |
| 2070 | #define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ |
| 2071 | #define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ |
| 2072 | |
| 2073 | /* |
| 2074 | ** Compute a complete annotation on a file. The file is identified |
| 2075 | ** by its filename number (filename.fnid) and the baseline in which |
| 2076 | ** it was checked in (mlink.mid). |
| @@ -2078,12 +2078,11 @@ | |
| 2078 | static void annotate_file( |
| 2079 | Annotator *p, /* The annotator */ |
| 2080 | int fnid, /* The name of the file to be annotated */ |
| 2081 | int mid, /* Use the version of the file in this check-in */ |
| 2082 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2083 | int annFlags, /* Flags to alter the annotation */ |
| 2084 | u64 diffFlags /* Flags to alter the whitespace handling */ |
| 2085 | ){ |
| 2086 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2087 | Blob step; /* Text of previous revision */ |
| 2088 | int rid; /* Artifact ID of the file being annotated */ |
| 2089 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2097,11 @@ | |
| 2098 | if( !content_get(rid, &toAnnotate) ){ |
| 2099 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2100 | } |
| 2101 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2102 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2103 | annotation_start(p, &toAnnotate, diffFlags); |
| 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 | ); |
| @@ -2133,11 +2132,11 @@ | |
| 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 | blob_to_utf8_no_bom(&step, 0); |
| 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,14 +2187,13 @@ | |
| 2188 | void annotation_page(void){ |
| 2189 | int mid; |
| 2190 | int fnid; |
| 2191 | int i; |
| 2192 | int iLimit; /* Depth limit */ |
| 2193 | int annFlags = ANN_FILE_ANCEST; |
| 2194 | int showLog = 0; /* True to display the log */ |
| 2195 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2196 | u64 diffFlags = 0; /* diff flags for ignore whitespace */ |
| 2197 | const char *zFilename; /* Name of file to annotate */ |
| 2198 | const char *zCI; /* The check-in containing zFilename */ |
| 2199 | Annotator ann; |
| 2200 | HQuery url; |
| 2201 | struct AnnVers *p; |
| @@ -2212,18 +2210,18 @@ | |
| 2212 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2213 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2214 | iLimit = atoi(PD("limit","20")); |
| 2215 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2216 | ignoreWs = P("w")!=0; |
| 2217 | if( ignoreWs ) diffFlags |= DIFF_IGNORE_ALLWS; |
| 2218 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2219 | fossil_redirect_home(); |
| 2220 | } |
| 2221 | |
| 2222 | /* compute the annotation */ |
| 2223 | compute_direct_ancestors(mid, 10000000); |
| 2224 | annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags); |
| 2225 | zCI = ann.aVers[0].zMUuid; |
| 2226 | |
| 2227 | /* generate the web page */ |
| 2228 | style_header("Annotation For %h", zFilename); |
| 2229 | if( bBlame ){ |
| @@ -2386,22 +2384,21 @@ | |
| 2386 | Annotator ann; /* The annotation of the file */ |
| 2387 | int i; /* Loop counter */ |
| 2388 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2389 | int iLimit; /* How far back in time to look */ |
| 2390 | int showLog; /* True to show the log */ |
| 2391 | u64 diffFlags = 0;/* Flags to control whitespace handling */ |
| 2392 | int fileVers; /* Show file version instead of check-in versions */ |
| 2393 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2394 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2395 | |
| 2396 | bBlame = g.argv[1][0]!='a'; |
| 2397 | zLimit = find_option("limit","n",1); |
| 2398 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2399 | iLimit = atoi(zLimit); |
| 2400 | showLog = find_option("log","l",0)!=0; |
| 2401 | if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; |
| 2402 | if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS; |
| 2403 | fileVers = find_option("filevers",0,0)!=0; |
| 2404 | db_must_be_within_tree(); |
| 2405 | if( g.argc<3 ) { |
| 2406 | usage("FILENAME"); |
| 2407 | } |
| @@ -2427,11 +2424,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 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2064,13 +2064,13 @@ | |
| 2064 | /* Return no errors */ |
| 2065 | return 0; |
| 2066 | } |
| 2067 | |
| 2068 | |
| 2069 | /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ |
| 2070 | #define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ |
| 2071 | #define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ |
| 2072 | |
| 2073 | /* |
| 2074 | ** Compute a complete annotation on a file. The file is identified |
| 2075 | ** by its filename number (filename.fnid) and the baseline in which |
| 2076 | ** it was checked in (mlink.mid). |
| @@ -2078,12 +2078,11 @@ | |
| 2078 | static void annotate_file( |
| 2079 | Annotator *p, /* The annotator */ |
| 2080 | int fnid, /* The name of the file to be annotated */ |
| 2081 | int mid, /* Use the version of the file in this check-in */ |
| 2082 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2083 | u64 annFlags /* Flags to alter the annotation */ |
| 2084 | ){ |
| 2085 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2086 | Blob step; /* Text of previous revision */ |
| 2087 | int rid; /* Artifact ID of the file being annotated */ |
| 2088 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2098,11 +2097,11 @@ | |
| 2097 | if( !content_get(rid, &toAnnotate) ){ |
| 2098 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2099 | } |
| 2100 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2101 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2102 | annotation_start(p, &toAnnotate, annFlags); |
| 2103 | db_begin_transaction(); |
| 2104 | db_multi_exec( |
| 2105 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2106 | "DELETE FROM vseen;" |
| 2107 | ); |
| @@ -2133,11 +2132,11 @@ | |
| 2132 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2133 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2134 | if( p->nVers ){ |
| 2135 | content_get(rid, &step); |
| 2136 | blob_to_utf8_no_bom(&step, 0); |
| 2137 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2138 | blob_reset(&step); |
| 2139 | } |
| 2140 | p->nVers++; |
| 2141 | db_bind_int(&ins, ":rid", rid); |
| 2142 | db_step(&ins); |
| @@ -2188,14 +2187,13 @@ | |
| 2187 | void annotation_page(void){ |
| 2188 | int mid; |
| 2189 | int fnid; |
| 2190 | int i; |
| 2191 | int iLimit; /* Depth limit */ |
| 2192 | u64 annFlags = ANN_FILE_ANCEST; |
| 2193 | int showLog = 0; /* True to display the log */ |
| 2194 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2195 | const char *zFilename; /* Name of file to annotate */ |
| 2196 | const char *zCI; /* The check-in containing zFilename */ |
| 2197 | Annotator ann; |
| 2198 | HQuery url; |
| 2199 | struct AnnVers *p; |
| @@ -2212,18 +2210,18 @@ | |
| 2210 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2211 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2212 | iLimit = atoi(PD("limit","20")); |
| 2213 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2214 | ignoreWs = P("w")!=0; |
| 2215 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2216 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2217 | fossil_redirect_home(); |
| 2218 | } |
| 2219 | |
| 2220 | /* compute the annotation */ |
| 2221 | compute_direct_ancestors(mid, 10000000); |
| 2222 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2223 | zCI = ann.aVers[0].zMUuid; |
| 2224 | |
| 2225 | /* generate the web page */ |
| 2226 | style_header("Annotation For %h", zFilename); |
| 2227 | if( bBlame ){ |
| @@ -2386,22 +2384,21 @@ | |
| 2384 | Annotator ann; /* The annotation of the file */ |
| 2385 | int i; /* Loop counter */ |
| 2386 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2387 | int iLimit; /* How far back in time to look */ |
| 2388 | int showLog; /* True to show the log */ |
| 2389 | int fileVers; /* Show file version instead of check-in versions */ |
| 2390 | u64 annFlags = 0; /* Flags to control annotation properties */ |
| 2391 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2392 | |
| 2393 | bBlame = g.argv[1][0]!='a'; |
| 2394 | zLimit = find_option("limit","n",1); |
| 2395 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2396 | iLimit = atoi(zLimit); |
| 2397 | showLog = find_option("log","l",0)!=0; |
| 2398 | if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS; |
| 2399 | if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2400 | fileVers = find_option("filevers",0,0)!=0; |
| 2401 | db_must_be_within_tree(); |
| 2402 | if( g.argc<3 ) { |
| 2403 | usage("FILENAME"); |
| 2404 | } |
| @@ -2427,11 +2424,11 @@ | |
| 2424 | fid, fnid); |
| 2425 | if( mid==0 ){ |
| 2426 | fossil_fatal("unable to find manifest"); |
| 2427 | } |
| 2428 | annFlags |= ANN_FILE_ANCEST; |
| 2429 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2430 | if( showLog ){ |
| 2431 | struct AnnVers *p; |
| 2432 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2433 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2434 | i+1, p->zDate, p->zMUuid, p->zFUuid); |
| 2435 |