Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhance the "fossil tag ls" command to allow filtering by tag type. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
971a1a99ddb70d20e4b154552535ca5f |
User & Date: | drh 2019-06-29 03:08:42 |
Context
2019-06-29
| ||
03:14 | Add the --save-password option to "fossil clone". Put the command-line options for "fossil clone" in alphabetical order. check-in: 421e6bb3 user: drh tags: trunk | |
03:08 | Enhance the "fossil tag ls" command to allow filtering by tag type. check-in: 971a1a99 user: drh tags: trunk | |
2019-06-27
| ||
23:37 | Small fixes to branching.wiki check-in: cdd5e576 user: wyoung tags: trunk | |
2019-06-22
| ||
16:57 | Enhance the "fossil tag ls" command to allow filtering by tag type. Closed-Leaf check-in: 2d3025ad user: andybradford tags: taglist-tagtype | |
Changes
Changes to src/tag.c.
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 ... 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 ... 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 ... 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
** of results to the given value. ** ** Options: ** --raw Raw tag name. ** -t|--type TYPE One of "ci", or "e". ** -n|--limit N Limit to N results. ** ** %fossil tag list|ls ?--raw? ?CHECK-IN? ** ** List all tags, or if CHECK-IN is supplied, list ** all tags and their values for CHECK-IN. ** ** The option --raw allows the manipulation of all types of tags ** used for various internal purposes in fossil. It also shows ** "cancel" tags for the "find" and "list" subcommands. You should ** not use this option to make changes unless you are sure what ** you are doing. ** ................................................................................ } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; int fRaw = find_option("raw","",0)!=0; if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" " AND tagtype>0)" " ORDER BY tagname" ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( fRaw ){ fossil_print("%s\n", zName); }else if( strncmp(zName, "sym-", 4)==0 ){ fossil_print("%s\n", &zName[4]); ................................................................................ } db_finalize(&q); }else if( g.argc==4 ){ int rid = name_to_rid(g.argv[3]); db_prepare(&q, "SELECT tagname, value FROM tagxref, tag" " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" " AND tagtype>%d" " ORDER BY tagname", rid, fRaw ? -1 : 0 ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); const char *zValue = db_column_text(&q, 1); if( fRaw==0 ){ if( strncmp(zName, "sym-", 4)!=0 ) continue; zName += 4; ................................................................................ fossil_print("%s=%s\n", zName, zValue); }else{ fossil_print("%s\n", zName); } } db_finalize(&q); }else{ usage("list ?CHECK-IN?"); } }else { goto tag_cmd_usage; } /* Cleanup */ |
| | > > > > > > > > > > > > > > > > > > > | | > > | | > | |
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 ... 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 ... 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 ... 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
** of results to the given value. ** ** Options: ** --raw Raw tag name. ** -t|--type TYPE One of "ci", or "e". ** -n|--limit N Limit to N results. ** ** %fossil tag list|ls ?OPTIONS? ?CHECK-IN? ** ** List all tags, or if CHECK-IN is supplied, list ** all tags and their values for CHECK-IN. The tagtype option ** takes one of: propagated, singleton, cancel. ** ** Options: ** --raw List tags raw names of tags ** --tagtype TYPE List only tags of type TYPE ** ** The option --raw allows the manipulation of all types of tags ** used for various internal purposes in fossil. It also shows ** "cancel" tags for the "find" and "list" subcommands. You should ** not use this option to make changes unless you are sure what ** you are doing. ** ................................................................................ } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; int fRaw = find_option("raw","",0)!=0; const char *zTagType = find_option("tagtype","t",1); int nTagType = fRaw ? -1 : 0; if( zTagType!=0 ){ int l = strlen(zTagType); if( strncmp(zTagType,"cancel",l)==0 ){ nTagType = 0; }else if( strncmp(zTagType,"singleton",l)==0 ){ nTagType = 1; }else if( strncmp(zTagType,"propagated",l)==0 ){ nTagType = 2; }else{ fossil_fatal("unrecognized tag type"); } } if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" " AND tagtype%c%d)" " ORDER BY tagname", zTagType!=0 ? '=' : '>', nTagType ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( fRaw ){ fossil_print("%s\n", zName); }else if( strncmp(zName, "sym-", 4)==0 ){ fossil_print("%s\n", &zName[4]); ................................................................................ } db_finalize(&q); }else if( g.argc==4 ){ int rid = name_to_rid(g.argv[3]); db_prepare(&q, "SELECT tagname, value FROM tagxref, tag" " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" " AND tagtype%c%d" " ORDER BY tagname", rid, zTagType!=0 ? '=' : '>', nTagType ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); const char *zValue = db_column_text(&q, 1); if( fRaw==0 ){ if( strncmp(zName, "sym-", 4)!=0 ) continue; zName += 4; ................................................................................ fossil_print("%s=%s\n", zName, zValue); }else{ fossil_print("%s\n", zName); } } db_finalize(&q); }else{ usage("list ?OPTIONS? ?CHECK-IN?"); } }else { goto tag_cmd_usage; } /* Cleanup */ |