Fossil SCM

Since Annotation flags and DIFF flags are so closely related, allow then to reside in a single variable

jan.nijtmans 2014-03-07 19:45 trunk
Commit 0bc584fe020fc430d122154fa5ab749c5b7759a6
1 file changed +13 -16
+13 -16
--- src/diff.c
+++ src/diff.c
@@ -2064,13 +2064,13 @@
20642064
/* Return no errors */
20652065
return 0;
20662066
}
20672067
20682068
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 */
20722072
20732073
/*
20742074
** Compute a complete annotation on a file. The file is identified
20752075
** by its filename number (filename.fnid) and the baseline in which
20762076
** it was checked in (mlink.mid).
@@ -2078,12 +2078,11 @@
20782078
static void annotate_file(
20792079
Annotator *p, /* The annotator */
20802080
int fnid, /* The name of the file to be annotated */
20812081
int mid, /* Use the version of the file in this check-in */
20822082
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 */
20852084
){
20862085
Blob toAnnotate; /* Text of the final (mid) version of the file */
20872086
Blob step; /* Text of previous revision */
20882087
int rid; /* Artifact ID of the file being annotated */
20892088
Stmt q; /* Query returning all ancestor versions */
@@ -2098,11 +2097,11 @@
20982097
if( !content_get(rid, &toAnnotate) ){
20992098
fossil_fatal("unable to retrieve content of artifact #%d", rid);
21002099
}
21012100
if( iLimit<=0 ) iLimit = 1000000000;
21022101
blob_to_utf8_no_bom(&toAnnotate, 0);
2103
- annotation_start(p, &toAnnotate, diffFlags);
2102
+ annotation_start(p, &toAnnotate, annFlags);
21042103
db_begin_transaction();
21052104
db_multi_exec(
21062105
"CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
21072106
"DELETE FROM vseen;"
21082107
);
@@ -2133,11 +2132,11 @@
21332132
p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
21342133
p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
21352134
if( p->nVers ){
21362135
content_get(rid, &step);
21372136
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);
21392138
blob_reset(&step);
21402139
}
21412140
p->nVers++;
21422141
db_bind_int(&ins, ":rid", rid);
21432142
db_step(&ins);
@@ -2188,14 +2187,13 @@
21882187
void annotation_page(void){
21892188
int mid;
21902189
int fnid;
21912190
int i;
21922191
int iLimit; /* Depth limit */
2193
- int annFlags = ANN_FILE_ANCEST;
2192
+ u64 annFlags = ANN_FILE_ANCEST;
21942193
int showLog = 0; /* True to display the log */
21952194
int ignoreWs = 0; /* Ignore whitespace */
2196
- u64 diffFlags = 0; /* diff flags for ignore whitespace */
21972195
const char *zFilename; /* Name of file to annotate */
21982196
const char *zCI; /* The check-in containing zFilename */
21992197
Annotator ann;
22002198
HQuery url;
22012199
struct AnnVers *p;
@@ -2212,18 +2210,18 @@
22122210
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
22132211
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
22142212
iLimit = atoi(PD("limit","20"));
22152213
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
22162214
ignoreWs = P("w")!=0;
2217
- if( ignoreWs ) diffFlags |= DIFF_IGNORE_ALLWS;
2215
+ if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS;
22182216
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
22192217
fossil_redirect_home();
22202218
}
22212219
22222220
/* compute the annotation */
22232221
compute_direct_ancestors(mid, 10000000);
2224
- annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags);
2222
+ annotate_file(&ann, fnid, mid, iLimit, annFlags);
22252223
zCI = ann.aVers[0].zMUuid;
22262224
22272225
/* generate the web page */
22282226
style_header("Annotation For %h", zFilename);
22292227
if( bBlame ){
@@ -2386,22 +2384,21 @@
23862384
Annotator ann; /* The annotation of the file */
23872385
int i; /* Loop counter */
23882386
const char *zLimit; /* The value to the -n|--limit option */
23892387
int iLimit; /* How far back in time to look */
23902388
int showLog; /* True to show the log */
2391
- u64 diffFlags = 0;/* Flags to control whitespace handling */
23922389
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 */
23942391
int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
23952392
23962393
bBlame = g.argv[1][0]!='a';
23972394
zLimit = find_option("limit","n",1);
23982395
if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
23992396
iLimit = atoi(zLimit);
24002397
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;
24032400
fileVers = find_option("filevers",0,0)!=0;
24042401
db_must_be_within_tree();
24052402
if( g.argc<3 ) {
24062403
usage("FILENAME");
24072404
}
@@ -2427,11 +2424,11 @@
24272424
fid, fnid);
24282425
if( mid==0 ){
24292426
fossil_fatal("unable to find manifest");
24302427
}
24312428
annFlags |= ANN_FILE_ANCEST;
2432
- annotate_file(&ann, fnid, mid, iLimit, annFlags, diffFlags);
2429
+ annotate_file(&ann, fnid, mid, iLimit, annFlags);
24332430
if( showLog ){
24342431
struct AnnVers *p;
24352432
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
24362433
fossil_print("version %3d: %s %.10s file %.10s\n",
24372434
i+1, p->zDate, p->zMUuid, p->zFUuid);
24382435
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button