Fossil SCM
Added -- support to (annotate, artifact, cat, clone).
Commit
ef763bcf08af754d1441f276dfdf3f56e329e9691c51e8ca58693d394c347ede
Parent
95ed189424cc856…
4 files changed
+4
-2
+8
-3
+4
-2
+4
-2
+4
-2
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -80,11 +80,11 @@ | ||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | /* |
| 83 | 83 | ** COMMAND: clone |
| 84 | 84 | ** |
| 85 | -** Usage: %fossil clone ?OPTIONS? URI FILENAME | |
| 85 | +** Usage: %fossil clone ?OPTIONS? URI ?--? FILENAME | |
| 86 | 86 | ** |
| 87 | 87 | ** Make a clone of a repository specified by URI in the local |
| 88 | 88 | ** file named FILENAME. |
| 89 | 89 | ** |
| 90 | 90 | ** URI may be one of the following form: ([...] mean optional) |
| @@ -118,10 +118,12 @@ | ||
| 118 | 118 | ** --save-http-password Remember the HTTP password without asking |
| 119 | 119 | ** --ssh-command|-c SSH Use SSH as the "ssh" command |
| 120 | 120 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 121 | 121 | ** -u|--unversioned Also sync unversioned content |
| 122 | 122 | ** -v|--verbose Show more statistics in output |
| 123 | +** -- Treat all following arguments as files, | |
| 124 | +** even if they look like flags. | |
| 123 | 125 | ** |
| 124 | 126 | ** See also: init |
| 125 | 127 | */ |
| 126 | 128 | void clone_cmd(void){ |
| 127 | 129 | char *zPassword; |
| @@ -145,11 +147,11 @@ | ||
| 145 | 147 | zDefaultUser = find_option("admin-user","A",1); |
| 146 | 148 | clone_ssh_find_options(); |
| 147 | 149 | url_proxy_options(); |
| 148 | 150 | |
| 149 | 151 | /* We should be done with options.. */ |
| 150 | - verify_all_options(); | |
| 152 | + verify_all_options2(); | |
| 151 | 153 | |
| 152 | 154 | if( g.argc < 4 ){ |
| 153 | 155 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 154 | 156 | } |
| 155 | 157 | db_open_config(0, 0); |
| 156 | 158 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -80,11 +80,11 @@ | |
| 80 | |
| 81 | |
| 82 | /* |
| 83 | ** COMMAND: clone |
| 84 | ** |
| 85 | ** Usage: %fossil clone ?OPTIONS? URI FILENAME |
| 86 | ** |
| 87 | ** Make a clone of a repository specified by URI in the local |
| 88 | ** file named FILENAME. |
| 89 | ** |
| 90 | ** URI may be one of the following form: ([...] mean optional) |
| @@ -118,10 +118,12 @@ | |
| 118 | ** --save-http-password Remember the HTTP password without asking |
| 119 | ** --ssh-command|-c SSH Use SSH as the "ssh" command |
| 120 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 121 | ** -u|--unversioned Also sync unversioned content |
| 122 | ** -v|--verbose Show more statistics in output |
| 123 | ** |
| 124 | ** See also: init |
| 125 | */ |
| 126 | void clone_cmd(void){ |
| 127 | char *zPassword; |
| @@ -145,11 +147,11 @@ | |
| 145 | zDefaultUser = find_option("admin-user","A",1); |
| 146 | clone_ssh_find_options(); |
| 147 | url_proxy_options(); |
| 148 | |
| 149 | /* We should be done with options.. */ |
| 150 | verify_all_options(); |
| 151 | |
| 152 | if( g.argc < 4 ){ |
| 153 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 154 | } |
| 155 | db_open_config(0, 0); |
| 156 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -80,11 +80,11 @@ | |
| 80 | |
| 81 | |
| 82 | /* |
| 83 | ** COMMAND: clone |
| 84 | ** |
| 85 | ** Usage: %fossil clone ?OPTIONS? URI ?--? FILENAME |
| 86 | ** |
| 87 | ** Make a clone of a repository specified by URI in the local |
| 88 | ** file named FILENAME. |
| 89 | ** |
| 90 | ** URI may be one of the following form: ([...] mean optional) |
| @@ -118,10 +118,12 @@ | |
| 118 | ** --save-http-password Remember the HTTP password without asking |
| 119 | ** --ssh-command|-c SSH Use SSH as the "ssh" command |
| 120 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 121 | ** -u|--unversioned Also sync unversioned content |
| 122 | ** -v|--verbose Show more statistics in output |
| 123 | ** -- Treat all following arguments as files, |
| 124 | ** even if they look like flags. |
| 125 | ** |
| 126 | ** See also: init |
| 127 | */ |
| 128 | void clone_cmd(void){ |
| 129 | char *zPassword; |
| @@ -145,11 +147,11 @@ | |
| 147 | zDefaultUser = find_option("admin-user","A",1); |
| 148 | clone_ssh_find_options(); |
| 149 | url_proxy_options(); |
| 150 | |
| 151 | /* We should be done with options.. */ |
| 152 | verify_all_options2(); |
| 153 | |
| 154 | if( g.argc < 4 ){ |
| 155 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| 156 | } |
| 157 | db_open_config(0, 0); |
| 158 |
+8
-3
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -310,28 +310,33 @@ | ||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /* |
| 313 | 313 | ** COMMAND: artifact* |
| 314 | 314 | ** |
| 315 | -** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? ?OPTIONS? | |
| 315 | +** Usage: %fossil artifact ARTIFACT-ID ?OPTIONS? ?--? ?OUTPUT-FILENAME? | |
| 316 | 316 | ** |
| 317 | 317 | ** Extract an artifact by its artifact hash and write the results on |
| 318 | 318 | ** standard output, or if the optional 4th argument is given, in |
| 319 | 319 | ** the named output file. |
| 320 | 320 | ** |
| 321 | 321 | ** Options: |
| 322 | 322 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 323 | +** -- Treat all following arguments as files, | |
| 324 | +** even if they look like flags and treat | |
| 325 | +** output filename "-" as a literal filename | |
| 326 | +** instead of an alias for stdout. | |
| 323 | 327 | ** |
| 324 | 328 | ** See also: finfo |
| 325 | 329 | */ |
| 326 | 330 | void artifact_cmd(void){ |
| 327 | 331 | int rid; |
| 328 | 332 | Blob content; |
| 329 | 333 | const char *zFile; |
| 330 | 334 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 331 | - if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); | |
| 332 | - zFile = g.argc==4 ? g.argv[3] : "-"; | |
| 335 | + verify_all_options2(); | |
| 336 | + if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?OPTIONS? ?--? ?FILENAME?"); | |
| 337 | + zFile = g.argc==4 ? get_dash_filename_arg(3) : "-"; | |
| 333 | 338 | rid = name_to_rid(g.argv[2]); |
| 334 | 339 | if( rid==0 ){ |
| 335 | 340 | fossil_fatal("%s",g.zErrMsg); |
| 336 | 341 | } |
| 337 | 342 | content_get(rid, &content); |
| 338 | 343 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -310,28 +310,33 @@ | |
| 310 | } |
| 311 | |
| 312 | /* |
| 313 | ** COMMAND: artifact* |
| 314 | ** |
| 315 | ** Usage: %fossil artifact ARTIFACT-ID ?OUTPUT-FILENAME? ?OPTIONS? |
| 316 | ** |
| 317 | ** Extract an artifact by its artifact hash and write the results on |
| 318 | ** standard output, or if the optional 4th argument is given, in |
| 319 | ** the named output file. |
| 320 | ** |
| 321 | ** Options: |
| 322 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 323 | ** |
| 324 | ** See also: finfo |
| 325 | */ |
| 326 | void artifact_cmd(void){ |
| 327 | int rid; |
| 328 | Blob content; |
| 329 | const char *zFile; |
| 330 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 331 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 332 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 333 | rid = name_to_rid(g.argv[2]); |
| 334 | if( rid==0 ){ |
| 335 | fossil_fatal("%s",g.zErrMsg); |
| 336 | } |
| 337 | content_get(rid, &content); |
| 338 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -310,28 +310,33 @@ | |
| 310 | } |
| 311 | |
| 312 | /* |
| 313 | ** COMMAND: artifact* |
| 314 | ** |
| 315 | ** Usage: %fossil artifact ARTIFACT-ID ?OPTIONS? ?--? ?OUTPUT-FILENAME? |
| 316 | ** |
| 317 | ** Extract an artifact by its artifact hash and write the results on |
| 318 | ** standard output, or if the optional 4th argument is given, in |
| 319 | ** the named output file. |
| 320 | ** |
| 321 | ** Options: |
| 322 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 323 | ** -- Treat all following arguments as files, |
| 324 | ** even if they look like flags and treat |
| 325 | ** output filename "-" as a literal filename |
| 326 | ** instead of an alias for stdout. |
| 327 | ** |
| 328 | ** See also: finfo |
| 329 | */ |
| 330 | void artifact_cmd(void){ |
| 331 | int rid; |
| 332 | Blob content; |
| 333 | const char *zFile; |
| 334 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 335 | verify_all_options2(); |
| 336 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?OPTIONS? ?--? ?FILENAME?"); |
| 337 | zFile = g.argc==4 ? get_dash_filename_arg(3) : "-"; |
| 338 | rid = name_to_rid(g.argv[2]); |
| 339 | if( rid==0 ){ |
| 340 | fossil_fatal("%s",g.zErrMsg); |
| 341 | } |
| 342 | content_get(rid, &content); |
| 343 |
+4
-2
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2534,11 +2534,11 @@ | ||
| 2534 | 2534 | /* |
| 2535 | 2535 | ** COMMAND: annotate |
| 2536 | 2536 | ** COMMAND: blame |
| 2537 | 2537 | ** COMMAND: praise |
| 2538 | 2538 | ** |
| 2539 | -** Usage: %fossil annotate|blame|praise ?OPTIONS? FILENAME | |
| 2539 | +** Usage: %fossil annotate|blame|praise ?OPTIONS? ?--? FILENAME | |
| 2540 | 2540 | ** |
| 2541 | 2541 | ** Output the text of a file with markings to show when each line of the file |
| 2542 | 2542 | ** was last modified. The version currently checked out is shown by default. |
| 2543 | 2543 | ** Other versions may be specified using the -r option. The "annotate" command |
| 2544 | 2544 | ** shows line numbers and omits the username. The "blame" and "praise" commands |
| @@ -2565,10 +2565,12 @@ | ||
| 2565 | 2565 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 2566 | 2566 | ** root of the repository. Set to "trunk" or |
| 2567 | 2567 | ** similar for a reverse annotation. |
| 2568 | 2568 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 2569 | 2569 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 2570 | +** -- Treat all following arguments as files, | |
| 2571 | +** even if they look like flags. | |
| 2570 | 2572 | ** |
| 2571 | 2573 | ** See also: info, finfo, timeline |
| 2572 | 2574 | */ |
| 2573 | 2575 | void annotate_cmd(void){ |
| 2574 | 2576 | const char *zRevision; /* Revision name, or NULL for current check-in */ |
| @@ -2597,11 +2599,11 @@ | ||
| 2597 | 2599 | } |
| 2598 | 2600 | fileVers = find_option("filevers",0,0)!=0; |
| 2599 | 2601 | db_must_be_within_tree(); |
| 2600 | 2602 | |
| 2601 | 2603 | /* We should be done with options.. */ |
| 2602 | - verify_all_options(); | |
| 2604 | + verify_all_options2(); | |
| 2603 | 2605 | |
| 2604 | 2606 | if( g.argc<3 ) { |
| 2605 | 2607 | usage("FILENAME"); |
| 2606 | 2608 | } |
| 2607 | 2609 | |
| 2608 | 2610 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2534,11 +2534,11 @@ | |
| 2534 | /* |
| 2535 | ** COMMAND: annotate |
| 2536 | ** COMMAND: blame |
| 2537 | ** COMMAND: praise |
| 2538 | ** |
| 2539 | ** Usage: %fossil annotate|blame|praise ?OPTIONS? FILENAME |
| 2540 | ** |
| 2541 | ** Output the text of a file with markings to show when each line of the file |
| 2542 | ** was last modified. The version currently checked out is shown by default. |
| 2543 | ** Other versions may be specified using the -r option. The "annotate" command |
| 2544 | ** shows line numbers and omits the username. The "blame" and "praise" commands |
| @@ -2565,10 +2565,12 @@ | |
| 2565 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 2566 | ** root of the repository. Set to "trunk" or |
| 2567 | ** similar for a reverse annotation. |
| 2568 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 2569 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 2570 | ** |
| 2571 | ** See also: info, finfo, timeline |
| 2572 | */ |
| 2573 | void annotate_cmd(void){ |
| 2574 | const char *zRevision; /* Revision name, or NULL for current check-in */ |
| @@ -2597,11 +2599,11 @@ | |
| 2597 | } |
| 2598 | fileVers = find_option("filevers",0,0)!=0; |
| 2599 | db_must_be_within_tree(); |
| 2600 | |
| 2601 | /* We should be done with options.. */ |
| 2602 | verify_all_options(); |
| 2603 | |
| 2604 | if( g.argc<3 ) { |
| 2605 | usage("FILENAME"); |
| 2606 | } |
| 2607 | |
| 2608 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2534,11 +2534,11 @@ | |
| 2534 | /* |
| 2535 | ** COMMAND: annotate |
| 2536 | ** COMMAND: blame |
| 2537 | ** COMMAND: praise |
| 2538 | ** |
| 2539 | ** Usage: %fossil annotate|blame|praise ?OPTIONS? ?--? FILENAME |
| 2540 | ** |
| 2541 | ** Output the text of a file with markings to show when each line of the file |
| 2542 | ** was last modified. The version currently checked out is shown by default. |
| 2543 | ** Other versions may be specified using the -r option. The "annotate" command |
| 2544 | ** shows line numbers and omits the username. The "blame" and "praise" commands |
| @@ -2565,10 +2565,12 @@ | |
| 2565 | ** -o|--origin VERSION The origin check-in. By default this is the |
| 2566 | ** root of the repository. Set to "trunk" or |
| 2567 | ** similar for a reverse annotation. |
| 2568 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 2569 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 2570 | ** -- Treat all following arguments as files, |
| 2571 | ** even if they look like flags. |
| 2572 | ** |
| 2573 | ** See also: info, finfo, timeline |
| 2574 | */ |
| 2575 | void annotate_cmd(void){ |
| 2576 | const char *zRevision; /* Revision name, or NULL for current check-in */ |
| @@ -2597,11 +2599,11 @@ | |
| 2599 | } |
| 2600 | fileVers = find_option("filevers",0,0)!=0; |
| 2601 | db_must_be_within_tree(); |
| 2602 | |
| 2603 | /* We should be done with options.. */ |
| 2604 | verify_all_options2(); |
| 2605 | |
| 2606 | if( g.argc<3 ) { |
| 2607 | usage("FILENAME"); |
| 2608 | } |
| 2609 | |
| 2610 |
+4
-2
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -235,19 +235,21 @@ | ||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /* |
| 238 | 238 | ** COMMAND: cat |
| 239 | 239 | ** |
| 240 | -** Usage: %fossil cat FILENAME ... ?OPTIONS? | |
| 240 | +** Usage: %fossil cat ?OPTIONS? ?--? FILENAME ... | |
| 241 | 241 | ** |
| 242 | 242 | ** Print on standard output the content of one or more files as they exist |
| 243 | 243 | ** in the repository. The version currently checked out is shown by default. |
| 244 | 244 | ** Other versions may be specified using the -r option. |
| 245 | 245 | ** |
| 246 | 246 | ** Options: |
| 247 | 247 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 248 | 248 | ** -r VERSION The specific check-in containing the file |
| 249 | +** -- Treat all following arguments as files, | |
| 250 | +** even if they look like flags. | |
| 249 | 251 | ** |
| 250 | 252 | ** See also: finfo |
| 251 | 253 | */ |
| 252 | 254 | void cat_cmd(void){ |
| 253 | 255 | int i; |
| @@ -255,11 +257,11 @@ | ||
| 255 | 257 | const char *zRev; |
| 256 | 258 | db_find_and_open_repository(0, 0); |
| 257 | 259 | zRev = find_option("r","r",1); |
| 258 | 260 | |
| 259 | 261 | /* We should be done with options.. */ |
| 260 | - verify_all_options(); | |
| 262 | + verify_all_options2(); | |
| 261 | 263 | |
| 262 | 264 | for(i=2; i<g.argc; i++){ |
| 263 | 265 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 264 | 266 | blob_zero(&content); |
| 265 | 267 | historical_blob(zRev, blob_str(&fname), &content, 1); |
| 266 | 268 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -235,19 +235,21 @@ | |
| 235 | } |
| 236 | |
| 237 | /* |
| 238 | ** COMMAND: cat |
| 239 | ** |
| 240 | ** Usage: %fossil cat FILENAME ... ?OPTIONS? |
| 241 | ** |
| 242 | ** Print on standard output the content of one or more files as they exist |
| 243 | ** in the repository. The version currently checked out is shown by default. |
| 244 | ** Other versions may be specified using the -r option. |
| 245 | ** |
| 246 | ** Options: |
| 247 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 248 | ** -r VERSION The specific check-in containing the file |
| 249 | ** |
| 250 | ** See also: finfo |
| 251 | */ |
| 252 | void cat_cmd(void){ |
| 253 | int i; |
| @@ -255,11 +257,11 @@ | |
| 255 | const char *zRev; |
| 256 | db_find_and_open_repository(0, 0); |
| 257 | zRev = find_option("r","r",1); |
| 258 | |
| 259 | /* We should be done with options.. */ |
| 260 | verify_all_options(); |
| 261 | |
| 262 | for(i=2; i<g.argc; i++){ |
| 263 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 264 | blob_zero(&content); |
| 265 | historical_blob(zRev, blob_str(&fname), &content, 1); |
| 266 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -235,19 +235,21 @@ | |
| 235 | } |
| 236 | |
| 237 | /* |
| 238 | ** COMMAND: cat |
| 239 | ** |
| 240 | ** Usage: %fossil cat ?OPTIONS? ?--? FILENAME ... |
| 241 | ** |
| 242 | ** Print on standard output the content of one or more files as they exist |
| 243 | ** in the repository. The version currently checked out is shown by default. |
| 244 | ** Other versions may be specified using the -r option. |
| 245 | ** |
| 246 | ** Options: |
| 247 | ** -R|--repository FILE Extract artifacts from repository FILE |
| 248 | ** -r VERSION The specific check-in containing the file |
| 249 | ** -- Treat all following arguments as files, |
| 250 | ** even if they look like flags. |
| 251 | ** |
| 252 | ** See also: finfo |
| 253 | */ |
| 254 | void cat_cmd(void){ |
| 255 | int i; |
| @@ -255,11 +257,11 @@ | |
| 257 | const char *zRev; |
| 258 | db_find_and_open_repository(0, 0); |
| 259 | zRev = find_option("r","r",1); |
| 260 | |
| 261 | /* We should be done with options.. */ |
| 262 | verify_all_options2(); |
| 263 | |
| 264 | for(i=2; i<g.argc; i++){ |
| 265 | file_tree_name(g.argv[i], &fname, 0, 1); |
| 266 | blob_zero(&content); |
| 267 | historical_blob(zRev, blob_str(&fname), &content, 1); |
| 268 |