Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the "fossil cat" command, which is an alias for "fossil finfo -p" |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
607ff0855c203c7c32dd469e538e6398 |
| User & Date: | drh 2012-11-28 20:37:40.097 |
Context
|
2012-11-28
| ||
| 23:05 | Serious bug fix: Avoid deleting the respository if the repository is in the checkout and you do a "fossil close". check-in: fcdeaa2909 user: drh tags: trunk | |
| 20:37 | Add the "fossil cat" command, which is an alias for "fossil finfo -p" check-in: 607ff0855c user: drh tags: trunk | |
| 19:28 | Take care that xfer error messages and user prompts always begin at the start of a new line. check-in: f1ef22136f user: drh tags: trunk | |
Changes
Changes to src/finfo.c.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 | /* ** COMMAND: finfo ** ** Usage: %fossil finfo ?OPTIONS? FILENAME ** ** Print the complete change history for a single file going backwards | | | | | | | | 22 23 24 25 26 27 28 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 |
/*
** COMMAND: finfo
**
** Usage: %fossil finfo ?OPTIONS? FILENAME
**
** Print the complete change history for a single file going backwards
** 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 "--limit N"
** and "--offset P" options limits the output to the first N changes
** after skipping P changes.
**
** 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:
** --brief|-b display a brief (one line / revision) summary
** --limit N display the first N changes
** --log|-l select log mode (the default)
** --offset P skip P changes
** -p select print mode
** --revision|-r R print the given revision (or ckout, if none is given)
** to stdout (only in print mode)
** -s select status mode (print a status indicator for FILE)
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
** boolean: "yes", "no", "true", "false", etc.
**
** See also: artifact, cat, descendants, info, leaves
*/
void finfo_cmd(void){
capture_case_sensitive_option();
db_must_be_within_tree();
if (find_option("status","s",0)) {
Stmt q;
Blob line;
|
| ︙ | ︙ | |||
183 184 185 186 187 188 189 |
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
const char *zBr = db_column_text(&q, 5);
char *zOut;
if( zBr==0 ) zBr = "trunk";
if( iBrief ){
fossil_print("%s ", zDate);
| > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
const char *zCom = db_column_text(&q, 3);
const char *zUser = db_column_text(&q, 4);
const char *zBr = db_column_text(&q, 5);
char *zOut;
if( zBr==0 ) zBr = "trunk";
if( iBrief ){
fossil_print("%s ", zDate);
zOut = sqlite3_mprintf(
"[%.10s] %s (user: %s, artifact: [%.10s], branch: %s)",
zCiUuid, zCom, zUser, zFileUuid, zBr);
comment_print(zOut, 11, 79);
sqlite3_free(zOut);
}else{
blob_reset(&line);
blob_appendf(&line, "%.10s ", zCiUuid);
blob_appendf(&line, "%.10s ", zDate);
blob_appendf(&line, "%8.8s ", zUser);
blob_appendf(&line, "%8.8s ", zBr);
blob_appendf(&line,"%-40.40s\n", zCom );
comment_print(blob_str(&line), 0, 79);
}
}
db_finalize(&q);
blob_reset(&fname);
}
}
/*
** COMMAND: cat
**
** Usage: %fossil cat FILENAME ... ?OPTIONS?
**
** Print on standard output the content of one or more files as they exist
** in the repository. The version currently checked out is shown by default.
** Other versions may be specified using the -r option.
**
** Options:
** -R|--repository FILE Extract artifacts from repository FILE
** -r VERSION The specific check-in containing the file
**
** See also: finfo
*/
void cat_cmd(void){
int i;
int rc;
Blob content, fname;
const char *zRev;
db_find_and_open_repository(0, 0);
zRev = find_option("r","r",1);
for(i=2; i<g.argc; i++){
file_tree_name(g.argv[i], &fname, 1);
blob_zero(&content);
rc = historical_version_of_file(zRev, blob_str(&fname), &content, 0,0,0,0);
if( rc==0 ){
fossil_fatal("no such file: %s", g.argv[i]);
}
blob_write_to_file(&content, "-");
blob_reset(&fname);
blob_reset(&content);
}
}
/* Values for the debug= query parameter to finfo */
#define FINFO_DEBUG_MLINK 0x01
/*
** WEBPAGE: finfo
** URL: /finfo?name=FILENAME
|
| ︙ | ︙ |