Fossil SCM

Enhance the web timeline so that with the "namechng" query parameter it shows only check-ins that involve filename changes.

drh 2013-03-14 14:56 trunk
Commit 1d2f4c2f260caa22a3df90fac84e03e57977cb92
1 file changed +27 -1
+27 -1
--- src/timeline.c
+++ src/timeline.c
@@ -110,10 +110,11 @@
110110
#define TIMELINE_GRAPH 0x0008 /* Compute a graph */
111111
#define TIMELINE_DISJOINT 0x0010 /* Elements are not contiguous */
112112
#define TIMELINE_FCHANGES 0x0020 /* Detail file changes */
113113
#define TIMELINE_BRCOLOR 0x0040 /* Background color by branch name */
114114
#define TIMELINE_UCOLOR 0x0080 /* Background color by user */
115
+#define TIMELINE_FRENAMES 0x0100 /* Detail only file name changes */
115116
#endif
116117
117118
/*
118119
** Hash a string and use the hash to determine a background color.
119120
*/
@@ -415,11 +416,13 @@
415416
if( xExtra ){
416417
xExtra(rid);
417418
}
418419
419420
/* 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
+ ){
421424
int inUl = 0;
422425
if( !fchngQueryInit ){
423426
db_prepare(&fchngQuery,
424427
"SELECT (pid==0) AS isnew,"
425428
" (fid==0) AS isdel,"
@@ -445,10 +448,16 @@
445448
const char *zNew = db_column_text(&fchngQuery, 3);
446449
if( !inUl ){
447450
@ <ul class="filelist">
448451
inUl = 1;
449452
}
453
+ if( (tmFlags & TIMELINE_FRENAMES)!=0 ){
454
+ if( !isNew && !isDel && fossil_strcmp(zOld,zNew)!=0 && zOldName!=0 ){
455
+ @ <li> %h(zOldName) &rarr; %h(zFilename)
456
+ }
457
+ continue;
458
+ }
450459
if( isNew ){
451460
@ <li> %h(zFilename) (new file) &nbsp;
452461
@ %z(xhref("target='diffwindow'","%R/artifact/%S",zNew))
453462
@ [view]</a></li>
454463
}else if( isDel ){
@@ -952,12 +961,14 @@
952961
** fc Show details of files changed
953962
** f=UUID Show family (immediate parents and children) of UUID
954963
** from=UUID Path from...
955964
** to=UUID ... to this
956965
** nomerge ... avoid merge links on the path
966
+** uf=FUUID Show only checkins that use given file version
957967
** brbg Background color from branch name
958968
** ubg Background color from user
969
+** namechng Show only checkins that filename changes
959970
**
960971
** p= and d= can appear individually or together. If either p= or d=
961972
** appear, then u=, y=, a=, and b= are ignored.
962973
**
963974
** If a= and b= appear, only a= is used. If neither appear, the most
@@ -981,10 +992,11 @@
981992
const char *zTagName = P("t"); /* Show events with this tag */
982993
const char *zBrName = P("r"); /* Show events related to this tag */
983994
const char *zSearch = P("s"); /* Search string */
984995
const char *zUses = P("uf"); /* Only show checkins hold this file */
985996
int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */
997
+ int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */
986998
int tagid; /* Tag ID */
987999
int tmFlags; /* Timeline flags */
9881000
const char *zThisTag = 0; /* Suppress links to this tag */
9891001
const char *zThisUser = 0; /* Suppress links to this user */
9901002
HQuery url; /* URL for various branch links */
@@ -1043,10 +1055,17 @@
10431055
compute_uses_file("usesfile", ufid, 0);
10441056
zType = "ci";
10451057
}else{
10461058
zUses = 0;
10471059
}
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
+ );
10481067
}
10491068
10501069
style_header("Timeline");
10511070
login_anonymous_available();
10521071
timeline_temp_table();
@@ -1151,10 +1170,13 @@
11511170
char *zNEntry = mprintf("%d", nEntry);
11521171
url_add_parameter(&url, "n", zNEntry);
11531172
if( zUses ){
11541173
blob_appendf(&sql, " AND event.objid IN usesfile ");
11551174
}
1175
+ if( renameOnly ){
1176
+ blob_appendf(&sql, " AND event.objid IN rnfile ");
1177
+ }
11561178
if( tagid>0 ){
11571179
blob_appendf(&sql,
11581180
"AND (EXISTS(SELECT 1 FROM tagxref"
11591181
" WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid);
11601182
@@ -1292,10 +1314,14 @@
12921314
char *zFilenames = names_of_file(zUses);
12931315
blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames,
12941316
href("%R/artifact/%S",zUses), zUses);
12951317
tmFlags |= TIMELINE_DISJOINT;
12961318
}
1319
+ if( renameOnly ){
1320
+ blob_appendf(&desc, " that contain filename changes");
1321
+ tmFlags |= TIMELINE_DISJOINT|TIMELINE_FRENAMES;
1322
+ }
12971323
if( zUser ){
12981324
blob_appendf(&desc, " by user %h", zUser);
12991325
tmFlags |= TIMELINE_DISJOINT;
13001326
}
13011327
if( zTagName ){
13021328
--- 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) &nbsp;
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) &rarr; %h(zFilename)
456 }
457 continue;
458 }
459 if( isNew ){
460 @ <li> %h(zFilename) (new file) &nbsp;
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

Keyboard Shortcuts

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