| | @@ -1239,15 +1239,17 @@ |
| 1239 | 1239 | ** 2. Date/Time |
| 1240 | 1240 | ** 3. Comment string and user |
| 1241 | 1241 | ** 4. Number of non-merge children |
| 1242 | 1242 | ** 5. Number of parents |
| 1243 | 1243 | */ |
| 1244 | | -void print_timeline(Stmt *q, int mxLine){ |
| 1244 | +void print_timeline(Stmt *q, int mxLine, int showfiles){ |
| 1245 | 1245 | int nLine = 0; |
| 1246 | 1246 | char zPrevDate[20]; |
| 1247 | 1247 | const char *zCurrentUuid=0; |
| 1248 | 1248 | zPrevDate[0] = 0; |
| 1249 | + int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 1250 | + Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 1249 | 1251 | |
| 1250 | 1252 | if( g.localOpen ){ |
| 1251 | 1253 | int rid = db_lget_int("checkout", 0); |
| 1252 | 1254 | zCurrentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1253 | 1255 | } |
| | @@ -1292,11 +1294,45 @@ |
| 1292 | 1294 | n += strlen(zPrefix); |
| 1293 | 1295 | } |
| 1294 | 1296 | zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); |
| 1295 | 1297 | nLine += comment_print(zFree, 9, 79); |
| 1296 | 1298 | sqlite3_free(zFree); |
| 1299 | + |
| 1300 | + if(showfiles){ |
| 1301 | + int inUl = 0; |
| 1302 | + if( !fchngQueryInit ){ |
| 1303 | + db_prepare(&fchngQuery, |
| 1304 | + "SELECT (pid==0) AS isnew," |
| 1305 | + " (fid==0) AS isdel," |
| 1306 | + " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 1307 | + " (SELECT uuid FROM blob WHERE rid=fid)," |
| 1308 | + " (SELECT uuid FROM blob WHERE rid=pid)" |
| 1309 | + " FROM mlink" |
| 1310 | + " WHERE mid=:mid AND pid!=fid" |
| 1311 | + " ORDER BY 3 /*sort*/" |
| 1312 | + ); |
| 1313 | + fchngQueryInit = 1; |
| 1314 | + } |
| 1315 | + db_bind_int(&fchngQuery, ":mid", rid); |
| 1316 | + while( db_step(&fchngQuery)==SQLITE_ROW ){ |
| 1317 | + const char *zFilename = db_column_text(&fchngQuery, 2); |
| 1318 | + int isNew = db_column_int(&fchngQuery, 0); |
| 1319 | + int isDel = db_column_int(&fchngQuery, 1); |
| 1320 | + const char *zOld = db_column_text(&fchngQuery, 4); |
| 1321 | + const char *zNew = db_column_text(&fchngQuery, 3); |
| 1322 | + if( isNew ){ |
| 1323 | + fossil_print(" ADDED %s\n",zFilename); |
| 1324 | + }else if( isDel ){ |
| 1325 | + fossil_print(" DELETED %s\n",zFilename); |
| 1326 | + }else{ |
| 1327 | + fossil_print(" EDITED %s\n", zFilename); |
| 1328 | + } |
| 1329 | + } |
| 1330 | + db_reset(&fchngQuery); |
| 1331 | + } |
| 1297 | 1332 | } |
| 1333 | + if( fchngQueryInit ) db_finalize(&fchngQuery); |
| 1298 | 1334 | } |
| 1299 | 1335 | |
| 1300 | 1336 | /* |
| 1301 | 1337 | ** Return a pointer to a static string that forms the basis for |
| 1302 | 1338 | ** a timeline query for display on a TTY. |
| | @@ -1337,11 +1373,11 @@ |
| 1337 | 1373 | } |
| 1338 | 1374 | |
| 1339 | 1375 | /* |
| 1340 | 1376 | ** COMMAND: timeline |
| 1341 | 1377 | ** |
| 1342 | | -** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?-n N? ?-t TYPE? |
| 1378 | +** Usage: %fossil timeline ?WHEN? ?BASELINE|DATETIME? ?-n N? ?-t TYPE? ?-showfiles? |
| 1343 | 1379 | ** |
| 1344 | 1380 | ** Print a summary of activity going backwards in date and time |
| 1345 | 1381 | ** specified or from the current date and time if no arguments |
| 1346 | 1382 | ** are given. Show as many as N (default 20) check-ins. The |
| 1347 | 1383 | ** WHEN argument can be any unique abbreviation of one of these |
| | @@ -1361,10 +1397,14 @@ |
| 1361 | 1397 | ** page. For example: |
| 1362 | 1398 | ** |
| 1363 | 1399 | ** w = wiki commits only |
| 1364 | 1400 | ** ci = file commits only |
| 1365 | 1401 | ** t = tickets only |
| 1402 | +** |
| 1403 | +** The optional showfiles argument if specified prints the list of |
| 1404 | +** files changed in a checkin after the checkin comment |
| 1405 | +** |
| 1366 | 1406 | */ |
| 1367 | 1407 | void timeline_cmd(void){ |
| 1368 | 1408 | Stmt q; |
| 1369 | 1409 | int n, k; |
| 1370 | 1410 | const char *zCount; |
| | @@ -1373,10 +1413,12 @@ |
| 1373 | 1413 | char *zDate; |
| 1374 | 1414 | Blob sql; |
| 1375 | 1415 | int objid = 0; |
| 1376 | 1416 | Blob uuid; |
| 1377 | 1417 | int mode = 0 ; /* 0:none 1: before 2:after 3:children 4:parents */ |
| 1418 | + int showfilesFlag = 0 ; |
| 1419 | + showfilesFlag = find_option("showfiles","f", 0)!=0; |
| 1378 | 1420 | db_find_and_open_repository(0, 0); |
| 1379 | 1421 | zCount = find_option("count","n",1); |
| 1380 | 1422 | zType = find_option("type","t",1); |
| 1381 | 1423 | if( zCount ){ |
| 1382 | 1424 | n = atoi(zCount); |
| | @@ -1399,13 +1441,13 @@ |
| 1399 | 1441 | mode = 4; |
| 1400 | 1442 | }else if(!zType && !zCount){ |
| 1401 | 1443 | usage("?WHEN? ?BASELINE|DATETIME? ?-n|--count N? ?-t TYPE?"); |
| 1402 | 1444 | } |
| 1403 | 1445 | if( '-' != *g.argv[3] ){ |
| 1404 | | - zOrigin = g.argv[3]; |
| 1446 | + zOrigin = g.argv[3]; |
| 1405 | 1447 | }else{ |
| 1406 | | - zOrigin = "now"; |
| 1448 | + zOrigin = "now"; |
| 1407 | 1449 | } |
| 1408 | 1450 | }else if( g.argc==3 ){ |
| 1409 | 1451 | zOrigin = g.argv[2]; |
| 1410 | 1452 | }else{ |
| 1411 | 1453 | zOrigin = "now"; |
| | @@ -1459,11 +1501,11 @@ |
| 1459 | 1501 | } |
| 1460 | 1502 | |
| 1461 | 1503 | blob_appendf(&sql, " ORDER BY event.mtime DESC"); |
| 1462 | 1504 | db_prepare(&q, blob_str(&sql)); |
| 1463 | 1505 | blob_reset(&sql); |
| 1464 | | - print_timeline(&q, n); |
| 1506 | + print_timeline(&q, n, showfilesFlag); |
| 1465 | 1507 | db_finalize(&q); |
| 1466 | 1508 | } |
| 1467 | 1509 | |
| 1468 | 1510 | /* |
| 1469 | 1511 | ** This is a version of the "localtime()" function from the standard |
| 1470 | 1512 | |