Fossil SCM
Retain original finfo behavior by introducing a new "mode" for artifact-id.
Commit
5015043b2d3e06fbbd274e103968ec6c5fac9ef3936b1af5d5aecae112f17412
Parent
243be3ef04b3b90…
1 file changed
+8
-3
+8
-3
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -31,10 +31,13 @@ | ||
| 31 | 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | 32 | ** is printed, otherwise the full comment is printed. The "-n|--limit N" |
| 33 | 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | 34 | ** after skipping P changes. |
| 35 | 35 | ** |
| 36 | +** The -i mode will print the artifact ID of FILENAME given the REVISION | |
| 37 | +** provided by the -r flag (which is required). | |
| 38 | + | |
| 36 | 39 | ** In the -s mode prints the status as <status> <revision>. This is |
| 37 | 40 | ** a quick status and does not check for up-to-date-ness of the file. |
| 38 | 41 | ** |
| 39 | 42 | ** In the -p mode, there's an optional flag "-r|--revision REVISION". |
| 40 | 43 | ** The specified version (or the latest checked out version) is printed |
| @@ -42,10 +45,11 @@ | ||
| 42 | 45 | ** |
| 43 | 46 | ** Options: |
| 44 | 47 | ** -b|--brief Display a brief (one line / revision) summary |
| 45 | 48 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | 49 | ** boolean: "yes", "no", "true", "false", etc. |
| 50 | +** -i|--id Print the artifact ID (requires -r) | |
| 47 | 51 | ** -l|--log Select log mode (the default) |
| 48 | 52 | ** -n|--limit N Display the first N changes (default unlimited). |
| 49 | 53 | ** N less than 0 means no limit. |
| 50 | 54 | ** --offset P Skip P changes |
| 51 | 55 | ** -p|--print Select print mode |
| @@ -56,12 +60,10 @@ | ||
| 56 | 60 | ** more than 22 or else 0 to indicate no limit. |
| 57 | 61 | ** |
| 58 | 62 | ** See also: [[artifact]], [[cat]], [[descendants]], [[info]], [[leaves]] |
| 59 | 63 | */ |
| 60 | 64 | void finfo_cmd(void){ |
| 61 | - const char *zRevision = find_option("revision", "r", 1); | |
| 62 | - | |
| 63 | 65 | db_must_be_within_tree(); |
| 64 | 66 | if( find_option("status","s",0) ){ |
| 65 | 67 | Stmt q; |
| 66 | 68 | Blob line; |
| 67 | 69 | Blob fname; |
| @@ -118,10 +120,11 @@ | ||
| 118 | 120 | blob_reset(&fname); |
| 119 | 121 | blob_reset(&line); |
| 120 | 122 | }else if( find_option("print","p",0) ){ |
| 121 | 123 | Blob record; |
| 122 | 124 | Blob fname; |
| 125 | + const char *zRevision = find_option("revision", "r", 1); | |
| 123 | 126 | |
| 124 | 127 | /* We should be done with options.. */ |
| 125 | 128 | verify_all_options(); |
| 126 | 129 | |
| 127 | 130 | file_tree_name(g.argv[2], &fname, 0, 1); |
| @@ -136,15 +139,17 @@ | ||
| 136 | 139 | content_get(rid, &record); |
| 137 | 140 | } |
| 138 | 141 | blob_write_to_file(&record, "-"); |
| 139 | 142 | blob_reset(&record); |
| 140 | 143 | blob_reset(&fname); |
| 141 | - }else if( zRevision && zRevision[0] ){ | |
| 144 | + }else if( find_option("id","i",0) ){ | |
| 142 | 145 | Blob fname; |
| 146 | + const char *zRevision = find_option("revision", "r", 1); | |
| 143 | 147 | |
| 144 | 148 | verify_all_options(); |
| 145 | 149 | |
| 150 | + if( zRevision==0 ) usage("-i|--id also requires -r|--revision"); | |
| 146 | 151 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 147 | 152 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 148 | 153 | int rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" |
| 149 | 154 | " (SELECT uuid FROM files_of_checkin(%Q)" |
| 150 | 155 | " WHERE filename=%B %s)", |
| 151 | 156 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -31,10 +31,13 @@ | |
| 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | ** is printed, otherwise the full comment is printed. The "-n|--limit N" |
| 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | ** after skipping P changes. |
| 35 | ** |
| 36 | ** In the -s mode prints the status as <status> <revision>. This is |
| 37 | ** a quick status and does not check for up-to-date-ness of the file. |
| 38 | ** |
| 39 | ** In the -p mode, there's an optional flag "-r|--revision REVISION". |
| 40 | ** The specified version (or the latest checked out version) is printed |
| @@ -42,10 +45,11 @@ | |
| 42 | ** |
| 43 | ** Options: |
| 44 | ** -b|--brief Display a brief (one line / revision) summary |
| 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | ** -l|--log Select log mode (the default) |
| 48 | ** -n|--limit N Display the first N changes (default unlimited). |
| 49 | ** N less than 0 means no limit. |
| 50 | ** --offset P Skip P changes |
| 51 | ** -p|--print Select print mode |
| @@ -56,12 +60,10 @@ | |
| 56 | ** more than 22 or else 0 to indicate no limit. |
| 57 | ** |
| 58 | ** See also: [[artifact]], [[cat]], [[descendants]], [[info]], [[leaves]] |
| 59 | */ |
| 60 | void finfo_cmd(void){ |
| 61 | const char *zRevision = find_option("revision", "r", 1); |
| 62 | |
| 63 | db_must_be_within_tree(); |
| 64 | if( find_option("status","s",0) ){ |
| 65 | Stmt q; |
| 66 | Blob line; |
| 67 | Blob fname; |
| @@ -118,10 +120,11 @@ | |
| 118 | blob_reset(&fname); |
| 119 | blob_reset(&line); |
| 120 | }else if( find_option("print","p",0) ){ |
| 121 | Blob record; |
| 122 | Blob fname; |
| 123 | |
| 124 | /* We should be done with options.. */ |
| 125 | verify_all_options(); |
| 126 | |
| 127 | file_tree_name(g.argv[2], &fname, 0, 1); |
| @@ -136,15 +139,17 @@ | |
| 136 | content_get(rid, &record); |
| 137 | } |
| 138 | blob_write_to_file(&record, "-"); |
| 139 | blob_reset(&record); |
| 140 | blob_reset(&fname); |
| 141 | }else if( zRevision && zRevision[0] ){ |
| 142 | Blob fname; |
| 143 | |
| 144 | verify_all_options(); |
| 145 | |
| 146 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 147 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 148 | int rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" |
| 149 | " (SELECT uuid FROM files_of_checkin(%Q)" |
| 150 | " WHERE filename=%B %s)", |
| 151 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -31,10 +31,13 @@ | |
| 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | ** is printed, otherwise the full comment is printed. The "-n|--limit N" |
| 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | ** after skipping P changes. |
| 35 | ** |
| 36 | ** The -i mode will print the artifact ID of FILENAME given the REVISION |
| 37 | ** provided by the -r flag (which is required). |
| 38 | |
| 39 | ** In the -s mode prints the status as <status> <revision>. This is |
| 40 | ** a quick status and does not check for up-to-date-ness of the file. |
| 41 | ** |
| 42 | ** In the -p mode, there's an optional flag "-r|--revision REVISION". |
| 43 | ** The specified version (or the latest checked out version) is printed |
| @@ -42,10 +45,11 @@ | |
| 45 | ** |
| 46 | ** Options: |
| 47 | ** -b|--brief Display a brief (one line / revision) summary |
| 48 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 49 | ** boolean: "yes", "no", "true", "false", etc. |
| 50 | ** -i|--id Print the artifact ID (requires -r) |
| 51 | ** -l|--log Select log mode (the default) |
| 52 | ** -n|--limit N Display the first N changes (default unlimited). |
| 53 | ** N less than 0 means no limit. |
| 54 | ** --offset P Skip P changes |
| 55 | ** -p|--print Select print mode |
| @@ -56,12 +60,10 @@ | |
| 60 | ** more than 22 or else 0 to indicate no limit. |
| 61 | ** |
| 62 | ** See also: [[artifact]], [[cat]], [[descendants]], [[info]], [[leaves]] |
| 63 | */ |
| 64 | void finfo_cmd(void){ |
| 65 | db_must_be_within_tree(); |
| 66 | if( find_option("status","s",0) ){ |
| 67 | Stmt q; |
| 68 | Blob line; |
| 69 | Blob fname; |
| @@ -118,10 +120,11 @@ | |
| 120 | blob_reset(&fname); |
| 121 | blob_reset(&line); |
| 122 | }else if( find_option("print","p",0) ){ |
| 123 | Blob record; |
| 124 | Blob fname; |
| 125 | const char *zRevision = find_option("revision", "r", 1); |
| 126 | |
| 127 | /* We should be done with options.. */ |
| 128 | verify_all_options(); |
| 129 | |
| 130 | file_tree_name(g.argv[2], &fname, 0, 1); |
| @@ -136,15 +139,17 @@ | |
| 139 | content_get(rid, &record); |
| 140 | } |
| 141 | blob_write_to_file(&record, "-"); |
| 142 | blob_reset(&record); |
| 143 | blob_reset(&fname); |
| 144 | }else if( find_option("id","i",0) ){ |
| 145 | Blob fname; |
| 146 | const char *zRevision = find_option("revision", "r", 1); |
| 147 | |
| 148 | verify_all_options(); |
| 149 | |
| 150 | if( zRevision==0 ) usage("-i|--id also requires -r|--revision"); |
| 151 | if( g.argc!=3 ) usage("-r|--revision REVISION FILENAME"); |
| 152 | file_tree_name(g.argv[2], &fname, 0, 1); |
| 153 | int rid = db_int(0, "SELECT rid FROM blob WHERE uuid =" |
| 154 | " (SELECT uuid FROM files_of_checkin(%Q)" |
| 155 | " WHERE filename=%B %s)", |
| 156 |