Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the "whatis" command. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
9c3ce9f6e28755955b596c982001d7f1 |
| User & Date: | drh 2011-11-03 18:59:57.743 |
Context
|
2011-11-04
| ||
| 15:40 | No longer display the server-code in info outputs as the server-code is no longer used for anything. Begin recording the location of local checkouts in the ~/.fossil database. check-in: 272e304d3f user: drh tags: trunk | |
|
2011-11-03
| ||
| 18:59 | Add the "whatis" command. check-in: 9c3ce9f6e2 user: drh tags: trunk | |
| 18:04 | Move "sha1sum" to an auxiliary command. Promote "test-md5sum" to an auxiliary command. check-in: dde919a463 user: drh tags: trunk | |
Changes
Changes to src/name.c.
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
rid = symbolic_name_to_rid(zName, "*");
if( rid<0 ){
cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath);
rid = 0;
}
return rid;
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
rid = symbolic_name_to_rid(zName, "*");
if( rid<0 ){
cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath);
rid = 0;
}
return rid;
}
/*
** COMMAND: whatis*
** Usage: %fossil whatis NAME
**
** Resolve the symbol NAME into its canonical 40-character SHA1-hash
** artifact name and provide a description of what role that artifact
** plays.
*/
void whatis_cmd(void){
int rid;
const char *zName;
int fExtra;
db_find_and_open_repository(0,0);
fExtra = find_option("verbose","v",0)!=0;
if( g.argc!=3 ) usage("whatis NAME");
zName = g.argv[2];
rid = symbolic_name_to_rid(zName, 0);
if( rid<0 ){
fossil_print("Ambiguous artifact name prefix: %s\n", zName);
}else if( rid==0 ){
fossil_print("Unknown artifact: %s\n", zName);
}else{
Stmt q;
db_prepare(&q, "SELECT uuid, size, datetime(mtime, 'localtime'), ipaddr"
" FROM blob, rcvfrom"
" WHERE rid=%d"
" AND rcvfrom.rcvid=blob.rcvid",
rid);
if( db_step(&q)==SQLITE_ROW ){
if( fExtra ){
fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid);
fossil_print("size: %d bytes\n", db_column_int(&q,1));
fossil_print("received: %s from %s\n",
db_column_text(&q, 2),
db_column_text(&q, 3));
}else{
fossil_print("artifact: %s\n", db_column_text(&q,0));
fossil_print("size: %d bytes\n", db_column_int(&q,1));
}
}
db_finalize(&q);
db_prepare(&q,
"SELECT type, datetime(mtime,'localtime'),"
" coalesce(euser,user), coalesce(ecomment,comment)"
" FROM event WHERE objid=%d", rid);
if( db_step(&q)==SQLITE_ROW ){
const char *zType;
switch( db_column_text(&q,0)[0] ){
case 'c': zType = "Check-in"; break;
case 'w': zType = "Wiki-edit"; break;
case 'e': zType = "Event"; break;
case 't': zType = "Ticket-change"; break;
case 'g': zType = "Tag-change"; break;
}
fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
db_column_text(&q, 1));
fossil_print("comment: ");
comment_print(db_column_text(&q,3), 10, 78);
}
db_finalize(&q);
db_prepare(&q,
"SELECT filename.name, blob.uuid, datetime(event.mtime,'localtime'),"
" coalesce(euser,user), coalesce(ecomment,comment)"
" FROM mlink, filename, blob, event"
" WHERE mlink.fid=%d"
" AND filename.fnid=mlink.fnid"
" AND event.objid=mlink.mid"
" AND blob.rid=mlink.mid"
" ORDER BY event.mtime DESC /*sort*/",
rid);
while( db_step(&q)==SQLITE_ROW ){
fossil_print("file: %s\n", db_column_text(&q,0));
fossil_print(" part of [%.10s] by %s on %s\n",
db_column_text(&q, 1),
db_column_text(&q, 3),
db_column_text(&q, 2));
fossil_print(" ");
comment_print(db_column_text(&q,4), 10, 78);
}
db_finalize(&q);
}
}
|