Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Enhancements to the "fossil finfo -i" command such that it only shows the first check-in for the file (unless -v is also used) and so that it shows the modification time as a separate line for easy parsing by scripts. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
ac6edb35dff3cc1546f7896b75a253a2 |
| User & Date: | drh 2022-09-23 17:13:26.769 |
Context
|
2022-09-25
| ||
| 06:50 | Prevent the web UI side-by-side diffs and their scrollbars from getting truncated on the right. [forum:f9becc251c| Forum Post f9becc251c]. check-in: 1a668d359a user: florian tags: trunk | |
|
2022-09-23
| ||
| 17:13 | Enhancements to the "fossil finfo -i" command such that it only shows the first check-in for the file (unless -v is also used) and so that it shows the modification time as a separate line for easy parsing by scripts. check-in: ac6edb35df user: drh tags: trunk | |
| 16:44 | Fix the help text for the previous check-in. check-in: c0162a4f09 user: drh tags: trunk | |
Changes
Changes to src/finfo.c.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 | ** in time. The default mode is -l. ** ** For the -l|--log mode: If "-b|--brief" is specified one line per revision ** is printed, otherwise the full comment is printed. The "-n|--limit N" ** and "--offset P" options limits the output to the first N changes ** after skipping P changes. ** | | > > > | | | | > > | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
** in time. The default mode is -l.
**
** For the -l|--log mode: If "-b|--brief" is specified one line per revision
** is printed, otherwise the full comment is printed. The "-n|--limit N"
** and "--offset P" options limits the output to the first N changes
** after skipping P changes.
**
** The -i mode will print various facts about FILENAME, including its
** hash and the check-in and time when the current version of the file
** was created. Use -v for additional information. Add the -r VERSION
** option to see similar information about the same file for the check-in
** specified by VERSION.
**
** In the -s mode prints the status as <status> <revision>. This is
** a quick status and does not check for up-to-date-ness of the file.
**
** In the -p mode, there's an optional flag "-r|--revision REVISION".
** The specified version (or the latest checked out version) is printed
** to stdout. The -p mode is another form of the "cat" command.
**
** Options:
** -b|--brief Display a brief (one line / revision) summary
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
** boolean: "yes", "no", "true", "false", etc.
** -i|--id Print the artifact ID
** -l|--log Select log mode (the default)
** -n|--limit N Display the first N changes (default unlimited).
** N less than 0 means no limit.
** --offset P Skip P changes
** -p|--print Select print mode
** -r|--revision R Print the given revision (or ckout, if none is given)
** to stdout (only in print mode)
** -s|--status Select status mode (print a status indicator for FILE)
** -v|--verbose On the -i option, show all check-ins that use the
** file, not just the earliest check-in
** -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;
|
| ︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
}
blob_write_to_file(&record, "-");
blob_reset(&record);
blob_reset(&fname);
}else if( find_option("id","i",0) ){
Blob fname;
int rid;
const char *zRevision = find_option("revision", "r", 1);
verify_all_options();
if( zRevision==0 ) zRevision = "current";
if( g.argc!=3 ) usage("FILENAME");
file_tree_name(g.argv[2], &fname, 0, 1);
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));
}
| > > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
}
blob_write_to_file(&record, "-");
blob_reset(&record);
blob_reset(&fname);
}else if( find_option("id","i",0) ){
Blob fname;
int rid;
int whatisFlags = WHATIS_BRIEF;
const char *zRevision = find_option("revision", "r", 1);
if( find_option("verbose","v",0)!=0 ) whatisFlags = 0;
verify_all_options();
if( zRevision==0 ) zRevision = "current";
if( g.argc!=3 ) usage("FILENAME");
file_tree_name(g.argv[2], &fname, 0, 1);
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,whatisFlags);
blob_reset(&fname);
}else{
Blob line;
Stmt q;
Blob fname;
int rid;
const char *zFilename;
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
842 843 844 845 846 847 848 849 850 851 |
case CFTYPE_TICKET: zType = "Ticket-change"; break;
case CFTYPE_CONTROL: zType = "Tag-change"; break;
default: break;
}
return zType;
}
/*
** Generate a description of artifact "rid"
*/
| > > > > > > > > | | | 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 |
case CFTYPE_TICKET: zType = "Ticket-change"; break;
case CFTYPE_CONTROL: zType = "Tag-change"; break;
default: break;
}
return zType;
}
/*
** Flag values for whatis_rid().
*/
#if INTERFACE
#define WHATIS_VERBOSE 0x01 /* Extra output */
#define WHATIS_BRIEF 0x02 /* Omit unnecessary output */
#endif
/*
** Generate a description of artifact "rid"
*/
void whatis_rid(int rid, int flags){
Stmt q;
int cnt;
/* Basic information about the object. */
db_prepare(&q,
"SELECT uuid, size, datetime(mtime,toLocal()), ipaddr"
" FROM blob, rcvfrom"
" WHERE rid=%d"
" AND rcvfrom.rcvid=blob.rcvid",
rid);
if( db_step(&q)==SQLITE_ROW ){
if( flags & WHATIS_VERBOSE ){
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));
|
| ︙ | ︙ | |||
938 939 940 941 942 943 944 |
"SELECT filename.name, blob.uuid, datetime(event.mtime,toLocal()),"
" 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"
| | | > > > > | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 |
"SELECT filename.name, blob.uuid, datetime(event.mtime,toLocal()),"
" 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 %s /*sort*/",
rid,
(flags & WHATIS_BRIEF) ? "LIMIT 1" : "DESC");
while( db_step(&q)==SQLITE_ROW ){
if( flags & WHATIS_BRIEF ){
fossil_print("mtime: %s\n", db_column_text(&q,2));
}
fossil_print("file: %s\n", db_column_text(&q,0));
fossil_print(" part of [%S] 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), 0, 12, -1, get_comment_format());
|
| ︙ | ︙ | |||
973 974 975 976 977 978 979 |
" WHERE blob.rid=%d",
rid
);
while( db_step(&q)==SQLITE_ROW ){
fossil_print("attachment: %s\n", db_column_text(&q,0));
fossil_print(" attached to %s %s\n",
db_column_text(&q,5), db_column_text(&q,4));
| | | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 |
" WHERE blob.rid=%d",
rid
);
while( db_step(&q)==SQLITE_ROW ){
fossil_print("attachment: %s\n", db_column_text(&q,0));
fossil_print(" attached to %s %s\n",
db_column_text(&q,5), db_column_text(&q,4));
if( flags & WHATIS_VERBOSE ){
fossil_print(" via %s (%d)\n",
db_column_text(&q,7), db_column_int(&q,6));
}else{
fossil_print(" via %s\n",
db_column_text(&q,7));
}
fossil_print(" by user %s on %s\n",
|
| ︙ | ︙ |