Fossil SCM
Correct operation of filevers query parameter to annotate pages
Commit
4b721600e7b8315e18cd6762d0da7d2fee1952027829e8ad673f18f426308933
Parent
41f35ca4ec61789…
1 file changed
+14
-9
+14
-9
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -43,13 +43,10 @@ | ||
| 43 | 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | 45 | #define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */ |
| 46 | 46 | #define DIFF_SLOW_SBS (((u64)0x20)<<32) /* Better, but slower side-by-side */ |
| 47 | 47 | |
| 48 | -/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ | |
| 49 | -#define ANN_FILE_VERS (((u64)0x40)<<32) /* File vers not commit vers */ | |
| 50 | - | |
| 51 | 48 | /* |
| 52 | 49 | ** These error messages are shared in multiple locations. They are defined |
| 53 | 50 | ** here for consistency. |
| 54 | 51 | */ |
| 55 | 52 | #define DIFF_CANNOT_COMPUTE_BINARY \ |
| @@ -2347,11 +2344,11 @@ | ||
| 2347 | 2344 | ** |
| 2348 | 2345 | ** Query parameters: |
| 2349 | 2346 | ** |
| 2350 | 2347 | ** checkin=ID The manifest ID at which to start the annotation |
| 2351 | 2348 | ** filename=FILENAME The filename. |
| 2352 | -** filevers Show file versions rather than check-in versions | |
| 2349 | +** filevers=BOOLEAN Show file versions rather than check-in versions | |
| 2353 | 2350 | ** limit=N Limit the search depth to N ancestors |
| 2354 | 2351 | ** log=BOOLEAN Show a log of versions analyzed |
| 2355 | 2352 | ** w Ignore whitespace |
| 2356 | 2353 | ** |
| 2357 | 2354 | */ |
| @@ -2358,10 +2355,11 @@ | ||
| 2358 | 2355 | void annotation_page(void){ |
| 2359 | 2356 | int i; |
| 2360 | 2357 | int iLimit; /* Depth limit */ |
| 2361 | 2358 | u64 annFlags = DIFF_STRIP_EOLCR; |
| 2362 | 2359 | int showLog = 0; /* True to display the log */ |
| 2360 | + int fileVers; /* Show file version instead of check-in versions */ | |
| 2363 | 2361 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2364 | 2362 | const char *zFilename; /* Name of file to annotate */ |
| 2365 | 2363 | const char *zRevision; /* Name of check-in from which to start annotation */ |
| 2366 | 2364 | const char *zCI; /* The check-in containing zFilename */ |
| 2367 | 2365 | Annotator ann; |
| @@ -2377,11 +2375,11 @@ | ||
| 2377 | 2375 | if( exclude_spiders() ) return; |
| 2378 | 2376 | load_control(); |
| 2379 | 2377 | zFilename = P("filename"); |
| 2380 | 2378 | zRevision = PD("checkin",0); |
| 2381 | 2379 | iLimit = atoi(PD("limit","20")); |
| 2382 | - if( P("filevers") ) annFlags |= ANN_FILE_VERS; | |
| 2380 | + fileVers = PB("filevers"); | |
| 2383 | 2381 | ignoreWs = P("w")!=0; |
| 2384 | 2382 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2385 | 2383 | |
| 2386 | 2384 | /* compute the annotation */ |
| 2387 | 2385 | annotate_file(&ann, zFilename, zRevision, iLimit, annFlags); |
| @@ -2411,10 +2409,15 @@ | ||
| 2411 | 2409 | if( showLog ){ |
| 2412 | 2410 | style_submenu_element("Hide Log", "%s", url_render(&url, "log", "0", 0, 0)); |
| 2413 | 2411 | }else{ |
| 2414 | 2412 | style_submenu_element("Show Log", "%s", url_render(&url, "log", "1", 0, 0)); |
| 2415 | 2413 | } |
| 2414 | + if( fileVers ){ | |
| 2415 | + style_submenu_element("Link to Check-ins", "%s", url_render(&url, "filevers", "0", 0, 0)); | |
| 2416 | + }else{ | |
| 2417 | + style_submenu_element("Link to Files", "%s", url_render(&url, "filevers", "1", 0, 0)); | |
| 2418 | + } | |
| 2416 | 2419 | if( ann.bLimit ){ |
| 2417 | 2420 | char *z1, *z2; |
| 2418 | 2421 | style_submenu_element("All Ancestors", "%s", |
| 2419 | 2422 | url_render(&url, "limit", "-1", 0, 0)); |
| 2420 | 2423 | z1 = sqlite3_mprintf("%d Ancestors", iLimit+20); |
| @@ -2484,27 +2487,29 @@ | ||
| 2484 | 2487 | if( iLimit>ann.nVers && iVers<0 ) iVers = ann.nVers-1; |
| 2485 | 2488 | |
| 2486 | 2489 | if( bBlame ){ |
| 2487 | 2490 | if( iVers>=0 ){ |
| 2488 | 2491 | struct AnnVers *p = ann.aVers+iVers; |
| 2489 | - char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid); | |
| 2492 | + const char *zUuid = fileVers ? p->zFUuid : p->zMUuid; | |
| 2493 | + char *zLink = xhref("target='infowindow'", "%R/info/%!S", zUuid); | |
| 2490 | 2494 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2491 | 2495 | "<span style='background-color:%s'>" |
| 2492 | 2496 | "%s%.10s</a> %s</span> %13.13s:", |
| 2493 | - p->zBgColor, zLink, p->zMUuid, p->zDate, p->zUser); | |
| 2497 | + p->zBgColor, zLink, zUuid, p->zDate, p->zUser); | |
| 2494 | 2498 | fossil_free(zLink); |
| 2495 | 2499 | }else{ |
| 2496 | 2500 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%36s", ""); |
| 2497 | 2501 | } |
| 2498 | 2502 | }else{ |
| 2499 | 2503 | if( iVers>=0 ){ |
| 2500 | 2504 | struct AnnVers *p = ann.aVers+iVers; |
| 2501 | - char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid); | |
| 2505 | + const char *zUuid = fileVers ? p->zFUuid : p->zMUuid; | |
| 2506 | + char *zLink = xhref("target='infowindow'", "%R/info/%!S", zUuid); | |
| 2502 | 2507 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2503 | 2508 | "<span style='background-color:%s'>" |
| 2504 | 2509 | "%s%.10s</a> %s</span> %4d:", |
| 2505 | - p->zBgColor, zLink, p->zMUuid, p->zDate, i+1); | |
| 2510 | + p->zBgColor, zLink, zUuid, p->zDate, i+1); | |
| 2506 | 2511 | fossil_free(zLink); |
| 2507 | 2512 | }else{ |
| 2508 | 2513 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%22s%4d:", "", i+1); |
| 2509 | 2514 | } |
| 2510 | 2515 | } |
| 2511 | 2516 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -43,13 +43,10 @@ | |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | #define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */ |
| 46 | #define DIFF_SLOW_SBS (((u64)0x20)<<32) /* Better, but slower side-by-side */ |
| 47 | |
| 48 | /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ |
| 49 | #define ANN_FILE_VERS (((u64)0x40)<<32) /* File vers not commit vers */ |
| 50 | |
| 51 | /* |
| 52 | ** These error messages are shared in multiple locations. They are defined |
| 53 | ** here for consistency. |
| 54 | */ |
| 55 | #define DIFF_CANNOT_COMPUTE_BINARY \ |
| @@ -2347,11 +2344,11 @@ | |
| 2347 | ** |
| 2348 | ** Query parameters: |
| 2349 | ** |
| 2350 | ** checkin=ID The manifest ID at which to start the annotation |
| 2351 | ** filename=FILENAME The filename. |
| 2352 | ** filevers Show file versions rather than check-in versions |
| 2353 | ** limit=N Limit the search depth to N ancestors |
| 2354 | ** log=BOOLEAN Show a log of versions analyzed |
| 2355 | ** w Ignore whitespace |
| 2356 | ** |
| 2357 | */ |
| @@ -2358,10 +2355,11 @@ | |
| 2358 | void annotation_page(void){ |
| 2359 | int i; |
| 2360 | int iLimit; /* Depth limit */ |
| 2361 | u64 annFlags = DIFF_STRIP_EOLCR; |
| 2362 | int showLog = 0; /* True to display the log */ |
| 2363 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2364 | const char *zFilename; /* Name of file to annotate */ |
| 2365 | const char *zRevision; /* Name of check-in from which to start annotation */ |
| 2366 | const char *zCI; /* The check-in containing zFilename */ |
| 2367 | Annotator ann; |
| @@ -2377,11 +2375,11 @@ | |
| 2377 | if( exclude_spiders() ) return; |
| 2378 | load_control(); |
| 2379 | zFilename = P("filename"); |
| 2380 | zRevision = PD("checkin",0); |
| 2381 | iLimit = atoi(PD("limit","20")); |
| 2382 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2383 | ignoreWs = P("w")!=0; |
| 2384 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2385 | |
| 2386 | /* compute the annotation */ |
| 2387 | annotate_file(&ann, zFilename, zRevision, iLimit, annFlags); |
| @@ -2411,10 +2409,15 @@ | |
| 2411 | if( showLog ){ |
| 2412 | style_submenu_element("Hide Log", "%s", url_render(&url, "log", "0", 0, 0)); |
| 2413 | }else{ |
| 2414 | style_submenu_element("Show Log", "%s", url_render(&url, "log", "1", 0, 0)); |
| 2415 | } |
| 2416 | if( ann.bLimit ){ |
| 2417 | char *z1, *z2; |
| 2418 | style_submenu_element("All Ancestors", "%s", |
| 2419 | url_render(&url, "limit", "-1", 0, 0)); |
| 2420 | z1 = sqlite3_mprintf("%d Ancestors", iLimit+20); |
| @@ -2484,27 +2487,29 @@ | |
| 2484 | if( iLimit>ann.nVers && iVers<0 ) iVers = ann.nVers-1; |
| 2485 | |
| 2486 | if( bBlame ){ |
| 2487 | if( iVers>=0 ){ |
| 2488 | struct AnnVers *p = ann.aVers+iVers; |
| 2489 | char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid); |
| 2490 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2491 | "<span style='background-color:%s'>" |
| 2492 | "%s%.10s</a> %s</span> %13.13s:", |
| 2493 | p->zBgColor, zLink, p->zMUuid, p->zDate, p->zUser); |
| 2494 | fossil_free(zLink); |
| 2495 | }else{ |
| 2496 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%36s", ""); |
| 2497 | } |
| 2498 | }else{ |
| 2499 | if( iVers>=0 ){ |
| 2500 | struct AnnVers *p = ann.aVers+iVers; |
| 2501 | char *zLink = xhref("target='infowindow'", "%R/info/%!S", p->zMUuid); |
| 2502 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2503 | "<span style='background-color:%s'>" |
| 2504 | "%s%.10s</a> %s</span> %4d:", |
| 2505 | p->zBgColor, zLink, p->zMUuid, p->zDate, i+1); |
| 2506 | fossil_free(zLink); |
| 2507 | }else{ |
| 2508 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%22s%4d:", "", i+1); |
| 2509 | } |
| 2510 | } |
| 2511 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -43,13 +43,10 @@ | |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | #define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */ |
| 46 | #define DIFF_SLOW_SBS (((u64)0x20)<<32) /* Better, but slower side-by-side */ |
| 47 | |
| 48 | /* |
| 49 | ** These error messages are shared in multiple locations. They are defined |
| 50 | ** here for consistency. |
| 51 | */ |
| 52 | #define DIFF_CANNOT_COMPUTE_BINARY \ |
| @@ -2347,11 +2344,11 @@ | |
| 2344 | ** |
| 2345 | ** Query parameters: |
| 2346 | ** |
| 2347 | ** checkin=ID The manifest ID at which to start the annotation |
| 2348 | ** filename=FILENAME The filename. |
| 2349 | ** filevers=BOOLEAN Show file versions rather than check-in versions |
| 2350 | ** limit=N Limit the search depth to N ancestors |
| 2351 | ** log=BOOLEAN Show a log of versions analyzed |
| 2352 | ** w Ignore whitespace |
| 2353 | ** |
| 2354 | */ |
| @@ -2358,10 +2355,11 @@ | |
| 2355 | void annotation_page(void){ |
| 2356 | int i; |
| 2357 | int iLimit; /* Depth limit */ |
| 2358 | u64 annFlags = DIFF_STRIP_EOLCR; |
| 2359 | int showLog = 0; /* True to display the log */ |
| 2360 | int fileVers; /* Show file version instead of check-in versions */ |
| 2361 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2362 | const char *zFilename; /* Name of file to annotate */ |
| 2363 | const char *zRevision; /* Name of check-in from which to start annotation */ |
| 2364 | const char *zCI; /* The check-in containing zFilename */ |
| 2365 | Annotator ann; |
| @@ -2377,11 +2375,11 @@ | |
| 2375 | if( exclude_spiders() ) return; |
| 2376 | load_control(); |
| 2377 | zFilename = P("filename"); |
| 2378 | zRevision = PD("checkin",0); |
| 2379 | iLimit = atoi(PD("limit","20")); |
| 2380 | fileVers = PB("filevers"); |
| 2381 | ignoreWs = P("w")!=0; |
| 2382 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2383 | |
| 2384 | /* compute the annotation */ |
| 2385 | annotate_file(&ann, zFilename, zRevision, iLimit, annFlags); |
| @@ -2411,10 +2409,15 @@ | |
| 2409 | if( showLog ){ |
| 2410 | style_submenu_element("Hide Log", "%s", url_render(&url, "log", "0", 0, 0)); |
| 2411 | }else{ |
| 2412 | style_submenu_element("Show Log", "%s", url_render(&url, "log", "1", 0, 0)); |
| 2413 | } |
| 2414 | if( fileVers ){ |
| 2415 | style_submenu_element("Link to Check-ins", "%s", url_render(&url, "filevers", "0", 0, 0)); |
| 2416 | }else{ |
| 2417 | style_submenu_element("Link to Files", "%s", url_render(&url, "filevers", "1", 0, 0)); |
| 2418 | } |
| 2419 | if( ann.bLimit ){ |
| 2420 | char *z1, *z2; |
| 2421 | style_submenu_element("All Ancestors", "%s", |
| 2422 | url_render(&url, "limit", "-1", 0, 0)); |
| 2423 | z1 = sqlite3_mprintf("%d Ancestors", iLimit+20); |
| @@ -2484,27 +2487,29 @@ | |
| 2487 | if( iLimit>ann.nVers && iVers<0 ) iVers = ann.nVers-1; |
| 2488 | |
| 2489 | if( bBlame ){ |
| 2490 | if( iVers>=0 ){ |
| 2491 | struct AnnVers *p = ann.aVers+iVers; |
| 2492 | const char *zUuid = fileVers ? p->zFUuid : p->zMUuid; |
| 2493 | char *zLink = xhref("target='infowindow'", "%R/info/%!S", zUuid); |
| 2494 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2495 | "<span style='background-color:%s'>" |
| 2496 | "%s%.10s</a> %s</span> %13.13s:", |
| 2497 | p->zBgColor, zLink, zUuid, p->zDate, p->zUser); |
| 2498 | fossil_free(zLink); |
| 2499 | }else{ |
| 2500 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%36s", ""); |
| 2501 | } |
| 2502 | }else{ |
| 2503 | if( iVers>=0 ){ |
| 2504 | struct AnnVers *p = ann.aVers+iVers; |
| 2505 | const char *zUuid = fileVers ? p->zFUuid : p->zMUuid; |
| 2506 | char *zLink = xhref("target='infowindow'", "%R/info/%!S", zUuid); |
| 2507 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
| 2508 | "<span style='background-color:%s'>" |
| 2509 | "%s%.10s</a> %s</span> %4d:", |
| 2510 | p->zBgColor, zLink, zUuid, p->zDate, i+1); |
| 2511 | fossil_free(zLink); |
| 2512 | }else{ |
| 2513 | sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%22s%4d:", "", i+1); |
| 2514 | } |
| 2515 | } |
| 2516 |