Fossil

Check-in [cb68b7dc3e]
Login

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

Overview
Comment:Enhance finfo command to print "whatis" information when -r is used without -p.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cb68b7dc3efb1ad34f453aa03f5354520e0ab22d6fceda1cdaa67b1b5d68fea7
User & Date: andybradford 2021-04-09 05:19:03.887
Context
2021-04-09
07:17
/chat internal doc correction and cleanup. No visible changes. check-in: 243be3ef04 user: stephan tags: trunk
05:19
Enhance finfo command to print "whatis" information when -r is used without -p. check-in: cb68b7dc3e user: andybradford tags: trunk
2021-04-08
11:34
Update the change log for the 2.14.1 and 2.15.1 patches. check-in: 041c3d1fa7 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/finfo.c.
54
55
56
57
58
59
60


61
62
63
64
65
66
67
**   -s|--status          Select status mode (print a status indicator for FILE)
**   -W|--width N         Width of lines (default is to auto-detect). Must be
**                        more than 22 or else 0 to indicate no limit.
**
** See also: [[artifact]], [[cat]], [[descendants]], [[info]], [[leaves]]
*/
void finfo_cmd(void){


  db_must_be_within_tree();
  if( find_option("status","s",0) ){
    Stmt q;
    Blob line;
    Blob fname;
    int vid;








>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
**   -s|--status          Select status mode (print a status indicator for FILE)
**   -W|--width N         Width of lines (default is to auto-detect). Must be
**                        more than 22 or else 0 to indicate no limit.
**
** See also: [[artifact]], [[cat]], [[descendants]], [[info]], [[leaves]]
*/
void finfo_cmd(void){
  const char *zRevision = find_option("revision", "r", 1);

  db_must_be_within_tree();
  if( find_option("status","s",0) ){
    Stmt q;
    Blob line;
    Blob fname;
    int vid;

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

















139
140
141
142
143
144
145
    db_finalize(&q);
    fossil_print("%s\n", blob_str(&line));
    blob_reset(&fname);
    blob_reset(&line);
  }else if( find_option("print","p",0) ){
    Blob record;
    Blob fname;
    const char *zRevision = find_option("revision", "r", 1);

    /* We should be done with options.. */
    verify_all_options();

    file_tree_name(g.argv[2], &fname, 0, 1);
    if( zRevision ){
      historical_blob(zRevision, blob_str(&fname), &record, 1);
    }else{
      int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
                       &fname, filename_collation());
      if( rid==0 ){
        fossil_fatal("no history for file: %b", &fname);
      }
      content_get(rid, &record);
    }
    blob_write_to_file(&record, "-");
    blob_reset(&record);

















    blob_reset(&fname);
  }else{
    Blob line;
    Stmt q;
    Blob fname;
    int rid;
    const char *zFilename;







<

















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    db_finalize(&q);
    fossil_print("%s\n", blob_str(&line));
    blob_reset(&fname);
    blob_reset(&line);
  }else if( find_option("print","p",0) ){
    Blob record;
    Blob fname;


    /* We should be done with options.. */
    verify_all_options();

    file_tree_name(g.argv[2], &fname, 0, 1);
    if( zRevision ){
      historical_blob(zRevision, blob_str(&fname), &record, 1);
    }else{
      int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
                       &fname, filename_collation());
      if( rid==0 ){
        fossil_fatal("no history for file: %b", &fname);
      }
      content_get(rid, &record);
    }
    blob_write_to_file(&record, "-");
    blob_reset(&record);
    blob_reset(&fname);
  }else if( zRevision && zRevision[0] ){
    Blob fname;

    verify_all_options();

    if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME");
    file_tree_name(g.argv[2], &fname, 0, 1);
    int rid = db_int(0, "SELECT rid FROM blob WHERE uuid ="
                         "  (SELECT uuid FROM files_of_checkin(%Q)"
                         "   WHERE filename=%B %s)",
                     zRevision, &fname, filename_collation());
    if( rid==0 ) {
      fossil_fatal("file not found for revision %s: %s",
                   zRevision, blob_str(&fname));
    }
    whatis_rid(rid,0);
    blob_reset(&fname);
  }else{
    Blob line;
    Stmt q;
    Blob fname;
    int rid;
    const char *zFilename;