Fossil SCM
Enhance the web timeline so that with the "namechng" query parameter it shows only check-ins that involve filename changes.
Commit
1d2f4c2f260caa22a3df90fac84e03e57977cb92
Parent
e320f0cd797b8c0…
1 file changed
+27
-1
+27
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -110,10 +110,11 @@ | ||
| 110 | 110 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 111 | 111 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 112 | 112 | #define TIMELINE_FCHANGES 0x0020 /* Detail file changes */ |
| 113 | 113 | #define TIMELINE_BRCOLOR 0x0040 /* Background color by branch name */ |
| 114 | 114 | #define TIMELINE_UCOLOR 0x0080 /* Background color by user */ |
| 115 | +#define TIMELINE_FRENAMES 0x0100 /* Detail only file name changes */ | |
| 115 | 116 | #endif |
| 116 | 117 | |
| 117 | 118 | /* |
| 118 | 119 | ** Hash a string and use the hash to determine a background color. |
| 119 | 120 | */ |
| @@ -415,11 +416,13 @@ | ||
| 415 | 416 | if( xExtra ){ |
| 416 | 417 | xExtra(rid); |
| 417 | 418 | } |
| 418 | 419 | |
| 419 | 420 | /* Generate the file-change list if requested */ |
| 420 | - if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.Hyperlink ){ | |
| 421 | + if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0 | |
| 422 | + && zType[0]=='c' && g.perm.Hyperlink | |
| 423 | + ){ | |
| 421 | 424 | int inUl = 0; |
| 422 | 425 | if( !fchngQueryInit ){ |
| 423 | 426 | db_prepare(&fchngQuery, |
| 424 | 427 | "SELECT (pid==0) AS isnew," |
| 425 | 428 | " (fid==0) AS isdel," |
| @@ -445,10 +448,16 @@ | ||
| 445 | 448 | const char *zNew = db_column_text(&fchngQuery, 3); |
| 446 | 449 | if( !inUl ){ |
| 447 | 450 | @ <ul class="filelist"> |
| 448 | 451 | inUl = 1; |
| 449 | 452 | } |
| 453 | + if( (tmFlags & TIMELINE_FRENAMES)!=0 ){ | |
| 454 | + if( !isNew && !isDel && fossil_strcmp(zOld,zNew)!=0 && zOldName!=0 ){ | |
| 455 | + @ <li> %h(zOldName) → %h(zFilename) | |
| 456 | + } | |
| 457 | + continue; | |
| 458 | + } | |
| 450 | 459 | if( isNew ){ |
| 451 | 460 | @ <li> %h(zFilename) (new file) |
| 452 | 461 | @ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew)) |
| 453 | 462 | @ [view]</a></li> |
| 454 | 463 | }else if( isDel ){ |
| @@ -952,12 +961,14 @@ | ||
| 952 | 961 | ** fc Show details of files changed |
| 953 | 962 | ** f=UUID Show family (immediate parents and children) of UUID |
| 954 | 963 | ** from=UUID Path from... |
| 955 | 964 | ** to=UUID ... to this |
| 956 | 965 | ** nomerge ... avoid merge links on the path |
| 966 | +** uf=FUUID Show only checkins that use given file version | |
| 957 | 967 | ** brbg Background color from branch name |
| 958 | 968 | ** ubg Background color from user |
| 969 | +** namechng Show only checkins that filename changes | |
| 959 | 970 | ** |
| 960 | 971 | ** p= and d= can appear individually or together. If either p= or d= |
| 961 | 972 | ** appear, then u=, y=, a=, and b= are ignored. |
| 962 | 973 | ** |
| 963 | 974 | ** If a= and b= appear, only a= is used. If neither appear, the most |
| @@ -981,10 +992,11 @@ | ||
| 981 | 992 | const char *zTagName = P("t"); /* Show events with this tag */ |
| 982 | 993 | const char *zBrName = P("r"); /* Show events related to this tag */ |
| 983 | 994 | const char *zSearch = P("s"); /* Search string */ |
| 984 | 995 | const char *zUses = P("uf"); /* Only show checkins hold this file */ |
| 985 | 996 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 997 | + int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */ | |
| 986 | 998 | int tagid; /* Tag ID */ |
| 987 | 999 | int tmFlags; /* Timeline flags */ |
| 988 | 1000 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 989 | 1001 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 990 | 1002 | HQuery url; /* URL for various branch links */ |
| @@ -1043,10 +1055,17 @@ | ||
| 1043 | 1055 | compute_uses_file("usesfile", ufid, 0); |
| 1044 | 1056 | zType = "ci"; |
| 1045 | 1057 | }else{ |
| 1046 | 1058 | zUses = 0; |
| 1047 | 1059 | } |
| 1060 | + } | |
| 1061 | + if( renameOnly ){ | |
| 1062 | + db_multi_exec( | |
| 1063 | + "CREATE TEMP TABLE rnfile(rid INTEGER PRIMARY KEY);" | |
| 1064 | + "INSERT OR IGNORE INTO rnfile" | |
| 1065 | + " SELECT mid FROM mlink WHERE pfnid>0 AND pfnid!=fnid;" | |
| 1066 | + ); | |
| 1048 | 1067 | } |
| 1049 | 1068 | |
| 1050 | 1069 | style_header("Timeline"); |
| 1051 | 1070 | login_anonymous_available(); |
| 1052 | 1071 | timeline_temp_table(); |
| @@ -1151,10 +1170,13 @@ | ||
| 1151 | 1170 | char *zNEntry = mprintf("%d", nEntry); |
| 1152 | 1171 | url_add_parameter(&url, "n", zNEntry); |
| 1153 | 1172 | if( zUses ){ |
| 1154 | 1173 | blob_appendf(&sql, " AND event.objid IN usesfile "); |
| 1155 | 1174 | } |
| 1175 | + if( renameOnly ){ | |
| 1176 | + blob_appendf(&sql, " AND event.objid IN rnfile "); | |
| 1177 | + } | |
| 1156 | 1178 | if( tagid>0 ){ |
| 1157 | 1179 | blob_appendf(&sql, |
| 1158 | 1180 | "AND (EXISTS(SELECT 1 FROM tagxref" |
| 1159 | 1181 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); |
| 1160 | 1182 | |
| @@ -1292,10 +1314,14 @@ | ||
| 1292 | 1314 | char *zFilenames = names_of_file(zUses); |
| 1293 | 1315 | blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames, |
| 1294 | 1316 | href("%R/artifact/%S",zUses), zUses); |
| 1295 | 1317 | tmFlags |= TIMELINE_DISJOINT; |
| 1296 | 1318 | } |
| 1319 | + if( renameOnly ){ | |
| 1320 | + blob_appendf(&desc, " that contain filename changes"); | |
| 1321 | + tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES; | |
| 1322 | + } | |
| 1297 | 1323 | if( zUser ){ |
| 1298 | 1324 | blob_appendf(&desc, " by user %h", zUser); |
| 1299 | 1325 | tmFlags |= TIMELINE_DISJOINT; |
| 1300 | 1326 | } |
| 1301 | 1327 | if( zTagName ){ |
| 1302 | 1328 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -110,10 +110,11 @@ | |
| 110 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 111 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 112 | #define TIMELINE_FCHANGES 0x0020 /* Detail file changes */ |
| 113 | #define TIMELINE_BRCOLOR 0x0040 /* Background color by branch name */ |
| 114 | #define TIMELINE_UCOLOR 0x0080 /* Background color by user */ |
| 115 | #endif |
| 116 | |
| 117 | /* |
| 118 | ** Hash a string and use the hash to determine a background color. |
| 119 | */ |
| @@ -415,11 +416,13 @@ | |
| 415 | if( xExtra ){ |
| 416 | xExtra(rid); |
| 417 | } |
| 418 | |
| 419 | /* Generate the file-change list if requested */ |
| 420 | if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.Hyperlink ){ |
| 421 | int inUl = 0; |
| 422 | if( !fchngQueryInit ){ |
| 423 | db_prepare(&fchngQuery, |
| 424 | "SELECT (pid==0) AS isnew," |
| 425 | " (fid==0) AS isdel," |
| @@ -445,10 +448,16 @@ | |
| 445 | const char *zNew = db_column_text(&fchngQuery, 3); |
| 446 | if( !inUl ){ |
| 447 | @ <ul class="filelist"> |
| 448 | inUl = 1; |
| 449 | } |
| 450 | if( isNew ){ |
| 451 | @ <li> %h(zFilename) (new file) |
| 452 | @ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew)) |
| 453 | @ [view]</a></li> |
| 454 | }else if( isDel ){ |
| @@ -952,12 +961,14 @@ | |
| 952 | ** fc Show details of files changed |
| 953 | ** f=UUID Show family (immediate parents and children) of UUID |
| 954 | ** from=UUID Path from... |
| 955 | ** to=UUID ... to this |
| 956 | ** nomerge ... avoid merge links on the path |
| 957 | ** brbg Background color from branch name |
| 958 | ** ubg Background color from user |
| 959 | ** |
| 960 | ** p= and d= can appear individually or together. If either p= or d= |
| 961 | ** appear, then u=, y=, a=, and b= are ignored. |
| 962 | ** |
| 963 | ** If a= and b= appear, only a= is used. If neither appear, the most |
| @@ -981,10 +992,11 @@ | |
| 981 | const char *zTagName = P("t"); /* Show events with this tag */ |
| 982 | const char *zBrName = P("r"); /* Show events related to this tag */ |
| 983 | const char *zSearch = P("s"); /* Search string */ |
| 984 | const char *zUses = P("uf"); /* Only show checkins hold this file */ |
| 985 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 986 | int tagid; /* Tag ID */ |
| 987 | int tmFlags; /* Timeline flags */ |
| 988 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 989 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 990 | HQuery url; /* URL for various branch links */ |
| @@ -1043,10 +1055,17 @@ | |
| 1043 | compute_uses_file("usesfile", ufid, 0); |
| 1044 | zType = "ci"; |
| 1045 | }else{ |
| 1046 | zUses = 0; |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | style_header("Timeline"); |
| 1051 | login_anonymous_available(); |
| 1052 | timeline_temp_table(); |
| @@ -1151,10 +1170,13 @@ | |
| 1151 | char *zNEntry = mprintf("%d", nEntry); |
| 1152 | url_add_parameter(&url, "n", zNEntry); |
| 1153 | if( zUses ){ |
| 1154 | blob_appendf(&sql, " AND event.objid IN usesfile "); |
| 1155 | } |
| 1156 | if( tagid>0 ){ |
| 1157 | blob_appendf(&sql, |
| 1158 | "AND (EXISTS(SELECT 1 FROM tagxref" |
| 1159 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); |
| 1160 | |
| @@ -1292,10 +1314,14 @@ | |
| 1292 | char *zFilenames = names_of_file(zUses); |
| 1293 | blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames, |
| 1294 | href("%R/artifact/%S",zUses), zUses); |
| 1295 | tmFlags |= TIMELINE_DISJOINT; |
| 1296 | } |
| 1297 | if( zUser ){ |
| 1298 | blob_appendf(&desc, " by user %h", zUser); |
| 1299 | tmFlags |= TIMELINE_DISJOINT; |
| 1300 | } |
| 1301 | if( zTagName ){ |
| 1302 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -110,10 +110,11 @@ | |
| 110 | #define TIMELINE_GRAPH 0x0008 /* Compute a graph */ |
| 111 | #define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */ |
| 112 | #define TIMELINE_FCHANGES 0x0020 /* Detail file changes */ |
| 113 | #define TIMELINE_BRCOLOR 0x0040 /* Background color by branch name */ |
| 114 | #define TIMELINE_UCOLOR 0x0080 /* Background color by user */ |
| 115 | #define TIMELINE_FRENAMES 0x0100 /* Detail only file name changes */ |
| 116 | #endif |
| 117 | |
| 118 | /* |
| 119 | ** Hash a string and use the hash to determine a background color. |
| 120 | */ |
| @@ -415,11 +416,13 @@ | |
| 416 | if( xExtra ){ |
| 417 | xExtra(rid); |
| 418 | } |
| 419 | |
| 420 | /* Generate the file-change list if requested */ |
| 421 | if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0 |
| 422 | && zType[0]=='c' && g.perm.Hyperlink |
| 423 | ){ |
| 424 | int inUl = 0; |
| 425 | if( !fchngQueryInit ){ |
| 426 | db_prepare(&fchngQuery, |
| 427 | "SELECT (pid==0) AS isnew," |
| 428 | " (fid==0) AS isdel," |
| @@ -445,10 +448,16 @@ | |
| 448 | const char *zNew = db_column_text(&fchngQuery, 3); |
| 449 | if( !inUl ){ |
| 450 | @ <ul class="filelist"> |
| 451 | inUl = 1; |
| 452 | } |
| 453 | if( (tmFlags & TIMELINE_FRENAMES)!=0 ){ |
| 454 | if( !isNew && !isDel && fossil_strcmp(zOld,zNew)!=0 && zOldName!=0 ){ |
| 455 | @ <li> %h(zOldName) → %h(zFilename) |
| 456 | } |
| 457 | continue; |
| 458 | } |
| 459 | if( isNew ){ |
| 460 | @ <li> %h(zFilename) (new file) |
| 461 | @ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew)) |
| 462 | @ [view]</a></li> |
| 463 | }else if( isDel ){ |
| @@ -952,12 +961,14 @@ | |
| 961 | ** fc Show details of files changed |
| 962 | ** f=UUID Show family (immediate parents and children) of UUID |
| 963 | ** from=UUID Path from... |
| 964 | ** to=UUID ... to this |
| 965 | ** nomerge ... avoid merge links on the path |
| 966 | ** uf=FUUID Show only checkins that use given file version |
| 967 | ** brbg Background color from branch name |
| 968 | ** ubg Background color from user |
| 969 | ** namechng Show only checkins that filename changes |
| 970 | ** |
| 971 | ** p= and d= can appear individually or together. If either p= or d= |
| 972 | ** appear, then u=, y=, a=, and b= are ignored. |
| 973 | ** |
| 974 | ** If a= and b= appear, only a= is used. If neither appear, the most |
| @@ -981,10 +992,11 @@ | |
| 992 | const char *zTagName = P("t"); /* Show events with this tag */ |
| 993 | const char *zBrName = P("r"); /* Show events related to this tag */ |
| 994 | const char *zSearch = P("s"); /* Search string */ |
| 995 | const char *zUses = P("uf"); /* Only show checkins hold this file */ |
| 996 | int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ |
| 997 | int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */ |
| 998 | int tagid; /* Tag ID */ |
| 999 | int tmFlags; /* Timeline flags */ |
| 1000 | const char *zThisTag = 0; /* Suppress links to this tag */ |
| 1001 | const char *zThisUser = 0; /* Suppress links to this user */ |
| 1002 | HQuery url; /* URL for various branch links */ |
| @@ -1043,10 +1055,17 @@ | |
| 1055 | compute_uses_file("usesfile", ufid, 0); |
| 1056 | zType = "ci"; |
| 1057 | }else{ |
| 1058 | zUses = 0; |
| 1059 | } |
| 1060 | } |
| 1061 | if( renameOnly ){ |
| 1062 | db_multi_exec( |
| 1063 | "CREATE TEMP TABLE rnfile(rid INTEGER PRIMARY KEY);" |
| 1064 | "INSERT OR IGNORE INTO rnfile" |
| 1065 | " SELECT mid FROM mlink WHERE pfnid>0 AND pfnid!=fnid;" |
| 1066 | ); |
| 1067 | } |
| 1068 | |
| 1069 | style_header("Timeline"); |
| 1070 | login_anonymous_available(); |
| 1071 | timeline_temp_table(); |
| @@ -1151,10 +1170,13 @@ | |
| 1170 | char *zNEntry = mprintf("%d", nEntry); |
| 1171 | url_add_parameter(&url, "n", zNEntry); |
| 1172 | if( zUses ){ |
| 1173 | blob_appendf(&sql, " AND event.objid IN usesfile "); |
| 1174 | } |
| 1175 | if( renameOnly ){ |
| 1176 | blob_appendf(&sql, " AND event.objid IN rnfile "); |
| 1177 | } |
| 1178 | if( tagid>0 ){ |
| 1179 | blob_appendf(&sql, |
| 1180 | "AND (EXISTS(SELECT 1 FROM tagxref" |
| 1181 | " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); |
| 1182 | |
| @@ -1292,10 +1314,14 @@ | |
| 1314 | char *zFilenames = names_of_file(zUses); |
| 1315 | blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames, |
| 1316 | href("%R/artifact/%S",zUses), zUses); |
| 1317 | tmFlags |= TIMELINE_DISJOINT; |
| 1318 | } |
| 1319 | if( renameOnly ){ |
| 1320 | blob_appendf(&desc, " that contain filename changes"); |
| 1321 | tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES; |
| 1322 | } |
| 1323 | if( zUser ){ |
| 1324 | blob_appendf(&desc, " by user %h", zUser); |
| 1325 | tmFlags |= TIMELINE_DISJOINT; |
| 1326 | } |
| 1327 | if( zTagName ){ |
| 1328 |