Fossil

Check-in [a73da231d8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the "fossil whatis" command so that it can accept multiple arguments.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a73da231d864b6b263e47bc4a7eac3c47d2714d3
User & Date: drh 2014-06-14 13:59:03.037
Context
2014-06-14
14:15
Minor performance optimizations on fusefs. check-in: bd4565e9d0 user: drh tags: trunk
13:59
Enhance the "fossil whatis" command so that it can accept multiple arguments. check-in: a73da231d8 user: drh tags: trunk
06:19
changelog update check-in: f99ef287dc user: jan.nijtmans tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/name.c.
654
655
656
657
658
659
660

661
662
663

664

665
666
667
668
669
670
671
672
673
674
675
676
677
678
679

680
681

682

683
684
685
686
687
688
689
** artifact name and provide a description of what role that artifact
** plays.
*/
void whatis_cmd(void){
  int rid;
  const char *zName;
  int verboseFlag;

  db_find_and_open_repository(0,0);
  verboseFlag = 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 ){
    Stmt q;
    int cnt = 0;
    fossil_print("Ambiguous artifact name prefix: %s\n", zName);
    db_prepare(&q,
       "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')",
       zName, zName
    );
    while( db_step(&q)==SQLITE_ROW ){
      if( cnt++ ) fossil_print("%.79c\n", '-');
      whatis_rid(db_column_int(&q, 0), verboseFlag);
    }
    db_finalize(&q);
  }else if( rid==0 ){

    fossil_print("Unknown artifact: %s\n", zName);
  }else{

    whatis_rid(rid, verboseFlag);

  }
}

/*
** COMMAND: test-whatis-all
** Usage: %fossil test-whatis-all
**







>


|
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
>
|
>







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
** artifact name and provide a description of what role that artifact
** plays.
*/
void whatis_cmd(void){
  int rid;
  const char *zName;
  int verboseFlag;
  int i;
  db_find_and_open_repository(0,0);
  verboseFlag = find_option("verbose","v",0)!=0;
  if( g.argc<3 ) usage("whatis NAME ...");
  for(i=2; i<g.argc; i++){
    zName = g.argv[i];
    if( i>2 ) fossil_print("%.79c\n",'-');
    rid = symbolic_name_to_rid(zName, 0);
    if( rid<0 ){
      Stmt q;
      int cnt = 0;
      fossil_print("name:       %s (ambiguous)\n", zName);
      db_prepare(&q,
         "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')",
         zName, zName
      );
      while( db_step(&q)==SQLITE_ROW ){
        if( cnt++ ) fossil_print("%12s---- meaning #%d ----\n", " ", cnt);
        whatis_rid(db_column_int(&q, 0), verboseFlag);
      }
      db_finalize(&q);
    }else if( rid==0 ){
                 /* 0123456789 12 */
      fossil_print("unknown:    %s\n", zName);
    }else{
      fossil_print("name:       %s\n", zName);
      whatis_rid(rid, verboseFlag);
    }
  }
}

/*
** COMMAND: test-whatis-all
** Usage: %fossil test-whatis-all
**