Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added -- support to (diff, finfo, grep, new). We can now grep for patterns which start with a dash. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | double-dash-flag |
| Files: | files | file ages | folders |
| SHA3-256: |
639b2c183e216c28de5f218233243d86 |
| User & Date: | stephan 2019-09-27 22:51:27.622 |
Context
|
2019-09-27
| ||
| 23:56 | Added -- support to (3-way-merge, open, sqlar, stash save|snapshot, tarball, touch, undo/redo, update, zip). Closed-Leaf check-in: 52ae3288ab user: stephan tags: double-dash-flag | |
| 22:51 | Added -- support to (diff, finfo, grep, new). We can now grep for patterns which start with a dash. check-in: 639b2c183e user: stephan tags: double-dash-flag | |
| 22:28 | Added -- support to (annotate, artifact, cat, clone). check-in: ef763bcf08 user: stephan tags: double-dash-flag | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
2211 2212 2213 2214 2215 2216 2217 | } } /* ** COMMAND: new* ** COMMAND: init ** | | | | 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | } } /* ** COMMAND: new* ** COMMAND: init ** ** Usage: %fossil new ?OPTIONS? ?--? FILENAME ** or: %fossil init ?OPTIONS? ?--? FILENAME ** ** Create a repository for a new project in the file named FILENAME. ** This command is distinct from "clone". The "clone" command makes ** a copy of an existing project. This command starts a new project. ** ** By default, your current login name is used to create the default ** admin user. This can be overridden using the -A|--admin-user |
| ︙ | ︙ | |||
2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 | ** associated permissions will be copied. ** ** Options: ** --template FILE Copy settings from repository file ** --admin-user|-A USERNAME Select given USERNAME as admin user ** --date-override DATETIME Use DATETIME as time of the initial check-in ** --sha1 Use a initial hash policy of "sha1" ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. ** | > > | 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 | ** associated permissions will be copied. ** ** Options: ** --template FILE Copy settings from repository file ** --admin-user|-A USERNAME Select given USERNAME as admin user ** --date-override DATETIME Use DATETIME as time of the initial check-in ** --sha1 Use a initial hash policy of "sha1" ** -- Treat all following arguments as files, ** even if they look like flags. ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. ** |
| ︙ | ︙ | |||
2258 2259 2260 2261 2262 2263 2264 |
zTemplate = find_option("template",0,1);
zDate = find_option("date-override",0,1);
zDefaultUser = find_option("admin-user","A",1);
bUseSha1 = find_option("sha1",0,0)!=0;
/* We should be done with options.. */
| | | 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 |
zTemplate = find_option("template",0,1);
zDate = find_option("date-override",0,1);
zDefaultUser = find_option("admin-user","A",1);
bUseSha1 = find_option("sha1",0,0)!=0;
/* We should be done with options.. */
verify_all_options2();
if( g.argc!=3 ){
usage("REPOSITORY-NAME");
}
if( -1 != file_size(g.argv[2], ExtFILE) ){
fossil_fatal("file already exists: %s", g.argv[2]);
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
778 779 780 781 782 783 784 | return zBinGlob; } /* ** COMMAND: diff ** COMMAND: gdiff ** | | | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | return zBinGlob; } /* ** COMMAND: diff ** COMMAND: gdiff ** ** Usage: %fossil diff|gdiff ?OPTIONS? ?--? ?FILE1? ?FILE2 ...? ** ** Show the difference between the current version of each of the FILEs ** specified (as they exist on disk) and that same file as it was checked ** out. Or if the FILE arguments are omitted, show the unsaved changes ** currently in the working check-out. ** ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| ︙ | ︙ | |||
837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
** --to VERSION Select VERSION as target for the diff
** --undo Diff against the "undo" buffer
** --unified Unified diff
** -v|--verbose Output complete text of added or deleted files
** -w|--ignore-all-space Ignore white space when comparing lines
** -W|--width <num> Width of lines in side-by-side diff
** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
*/
void diff_cmd(void){
int isGDiff; /* True for gdiff. False for normal diff */
int isInternDiff; /* True for internal diff */
int verboseFlag; /* True if -v or --verbose flag is used */
const char *zFrom; /* Source version number */
const char *zTo; /* Target version number */
| > > | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
** --to VERSION Select VERSION as target for the diff
** --undo Diff against the "undo" buffer
** --unified Unified diff
** -v|--verbose Output complete text of added or deleted files
** -w|--ignore-all-space Ignore white space when comparing lines
** -W|--width <num> Width of lines in side-by-side diff
** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
** -- Treat all following arguments as files,
** even if they look like flags.
*/
void diff_cmd(void){
int isGDiff; /* True for gdiff. False for normal diff */
int isInternDiff; /* True for internal diff */
int verboseFlag; /* True if -v or --verbose flag is used */
const char *zFrom; /* Source version number */
const char *zTo; /* Target version number */
|
| ︙ | ︙ | |||
898 899 900 901 902 903 904 |
if( !isInternDiff ){
zDiffCmd = find_option("command", 0, 1);
if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
}
zBinGlob = diff_get_binary_glob();
fIncludeBinary = diff_include_binary_files();
determine_exec_relative_option(1);
| | | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
if( !isInternDiff ){
zDiffCmd = find_option("command", 0, 1);
if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
}
zBinGlob = diff_get_binary_glob();
fIncludeBinary = diff_include_binary_files();
determine_exec_relative_option(1);
verify_all_options2();
if( g.argc>=3 ){
int i;
Blob fname;
pFileDir = fossil_malloc( sizeof(*pFileDir) * (g.argc-1) );
memset(pFileDir, 0, sizeof(*pFileDir) * (g.argc-1));
for(i=2; i<g.argc; i++){
file_tree_name(g.argv[i], &fname, 0, 1);
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | */ #include "config.h" #include "finfo.h" /* ** COMMAND: finfo ** | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | */ #include "config.h" #include "finfo.h" /* ** 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 "-n|--limit N" ** and "--offset P" options limits the output to the first N changes |
| ︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
** -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)
** -W|--width <num> Width of lines (default is to auto-detect). Must be
** >22 or 0 (= no limit, resulting in a single line per
** entry).
**
** 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;
/* We should be done with options.. */
| > > | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
** -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)
** -W|--width <num> Width of lines (default is to auto-detect). Must be
** >22 or 0 (= no limit, resulting in a single line per
** entry).
** -- Treat all following arguments as files, even if they
** look like flags.
**
** 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;
/* We should be done with options.. */
verify_all_options2();
if( g.argc!=3 ) usage("-s|--status FILENAME");
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("no checkout to finfo files in");
}
vfile_check_signature(vid, CKSIG_ENOTFILE);
|
| ︙ | ︙ | |||
118 119 120 121 122 123 124 |
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.. */
| | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
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_options2();
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());
|
| ︙ | ︙ | |||
167 168 169 170 171 172 173 |
fossil_fatal("-W|--width value must be >22 or 0");
}
}else{
iWidth = -1;
}
/* We should be done with options.. */
| | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
fossil_fatal("-W|--width value must be >22 or 0");
}
}else{
iWidth = -1;
}
/* We should be done with options.. */
verify_all_options2();
if( g.argc!=3 ){
usage("?-l|--log? ?-b|--brief? FILENAME");
}
file_tree_name(g.argv[2], &fname, 0, 1);
rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s",
&fname, filename_collation());
|
| ︙ | ︙ |
Changes to src/regexp.c.
| ︙ | ︙ | |||
785 786 787 788 789 790 791 | } re_free(pRe); } /* ** COMMAND: grep ** | | > > > | | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
}
re_free(pRe);
}
/*
** COMMAND: grep
**
** Usage: %fossil grep [OPTIONS] ?--? PATTERN FILENAME
**
** Attempt to match the given POSIX extended regular expression PATTERN
** over all historic versions of FILENAME. For details of the supported
** RE dialect, see https://fossil-scm.org/fossil/doc/trunk/www/grep.md
**
** Options:
**
** -i|--ignore-case Ignore case
** -l|--files-with-matches List only checkin ID for versions that match
** -v|--verbose Show each file as it is analyzed
** -- Treat all following arguments as non-flags,
** even if they look like flags. Use this before
** the PATTERN or FILENAME, but not both.
*/
void re_grep_cmd(void){
u32 flags = 0;
int bVerbose = 0;
ReCompiled *pRe;
const char *zErr;
int ignoreCase = 0;
Blob fullName;
if( find_option("ignore-case","i",0)!=0 ) ignoreCase = 1;
if( find_option("files-with-matches","l",0)!=0 ) flags |= GREP_EXISTS;
if( find_option("verbose","v",0)!=0 ) bVerbose = 1;
db_find_and_open_repository(0, 0);
verify_all_options2();
if( g.argc<4 ){
usage("REGEXP FILENAME");
}
zErr = re_compile(&pRe, g.argv[2], ignoreCase);
if( zErr ) fossil_fatal("%s", zErr);
if( file_tree_name(g.argv[3], &fullName, 0, 0) ){
|
| ︙ | ︙ |