Fossil SCM

Added -- support to (changes, clean, extras, ls, commit).

stephan 2019-09-27 16:26 double-dash-flag
Commit 1b649b9d4e94168d15774aca5956ce63d94afeab5e0f76daad6c62990c8152c7
1 file changed +21 -11
+21 -11
--- src/checkin.c
+++ src/checkin.c
@@ -352,11 +352,11 @@
352352
353353
/*
354354
** COMMAND: changes
355355
** COMMAND: status
356356
**
357
-** Usage: %fossil changes|status ?OPTIONS? ?PATHS ...?
357
+** Usage: %fossil changes|status ?OPTIONS? [--] ?PATHS ...?
358358
**
359359
** Report the change status of files in the current checkout. If one or
360360
** more PATHS are specified, only changes among the named files and
361361
** directories are reported. Directories are searched recursively.
362362
**
@@ -439,10 +439,12 @@
439439
** --all Display all managed files, i.e. all of the above.
440440
** --extra Display unmanaged files.
441441
** --differ Display modified and extra files.
442442
** --merge Display merge contributors.
443443
** --no-merge Do not display merge contributors.
444
+** -- Treat all following arguments as files,
445
+** even if they look like flags.
444446
**
445447
** See also: extras, ls
446448
*/
447449
void status_cmd(void){
448450
/* Affirmative and negative flag option tables. */
@@ -526,11 +528,11 @@
526528
if( find_option("dotfiles", 0, 0) || db_get_boolean("dotfiles", 0) ){
527529
scanFlags = SCAN_ALL;
528530
}
529531
530532
/* We should be done with options. */
531
- verify_all_options();
533
+ verify_all_options2();
532534
533535
/* Check for changed files. */
534536
vfile_check_signature(vid, useHash ? CKSIG_HASH : 0);
535537
536538
/* Search for unmanaged files if requested. */
@@ -647,11 +649,11 @@
647649
}
648650
649651
/*
650652
** COMMAND: ls
651653
**
652
-** Usage: %fossil ls ?OPTIONS? ?PATHS ...?
654
+** Usage: %fossil ls ?OPTIONS? [--] ?PATHS ...?
653655
**
654656
** List all files in the current checkout. If PATHS is included, only the
655657
** named files (or their children if directories) are shown.
656658
**
657659
** The ls command is essentially two related commands in one, depending on
@@ -675,10 +677,12 @@
675677
** --age Show when each file was committed.
676678
** -v|--verbose Provide extra information about each file.
677679
** -t Sort output in time order.
678680
** -r VERSION The specific check-in to list.
679681
** -R|--repository FILE Extract info from repository FILE.
682
+** -- Treat all following arguments as files,
683
+** even if they look like flags.
680684
**
681685
** See also: changes, extras, status
682686
*/
683687
void ls_cmd(void){
684688
int vid;
@@ -700,11 +704,11 @@
700704
zRev = find_option("r","r",1);
701705
timeOrder = find_option("t","t",0)!=0;
702706
703707
if( zRev!=0 ){
704708
db_find_and_open_repository(0, 0);
705
- verify_all_options();
709
+ verify_all_options2();
706710
ls_cmd_rev(zRev,verboseFlag,showAge,timeOrder);
707711
return;
708712
}else if( find_option("R",0,1)!=0 ){
709713
fossil_fatal("the -r is required in addition to -R");
710714
}
@@ -805,11 +809,11 @@
805809
}
806810
807811
/*
808812
** COMMAND: extras
809813
**
810
-** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
814
+** Usage: %fossil extras ?OPTIONS? [--] ?PATH1 ...?
811815
**
812816
** Print a list of all files in the source tree that are not part of the
813817
** current checkout. See also the "clean" command. If paths are specified,
814818
** only files in the given directories will be listed.
815819
**
@@ -829,10 +833,12 @@
829833
** --dotfiles include files beginning with a dot (".")
830834
** --header Identify the repository if there are extras
831835
** --ignore <CSG> ignore files matching patterns from the argument
832836
** --rel-paths Display pathnames relative to the current working
833837
** directory.
838
+** -- Treat all following arguments as files,
839
+** even if they look like flags.
834840
**
835841
** See also: changes, clean, status
836842
*/
837843
void extras_cmd(void){
838844
Blob report = BLOB_INITIALIZER;
@@ -850,11 +856,11 @@
850856
}
851857
852858
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
853859
854860
/* We should be done with options.. */
855
- verify_all_options();
861
+ verify_all_options2();
856862
857863
if( zIgnoreFlag==0 ){
858864
zIgnoreFlag = db_get("ignore-glob", 0);
859865
}
860866
pIgnore = glob_create(zIgnoreFlag);
@@ -876,11 +882,11 @@
876882
}
877883
878884
/*
879885
** COMMAND: clean
880886
**
881
-** Usage: %fossil clean ?OPTIONS? ?PATH ...?
887
+** Usage: %fossil clean ?OPTIONS? [--] ?PATH ...?
882888
**
883889
** Delete all "extra" files in the source tree. "Extra" files are files
884890
** that are not officially part of the checkout. If one or more PATH
885891
** arguments appear, then only the files named, or files contained with
886892
** directories named, will be removed.
@@ -953,10 +959,12 @@
953959
** deleted.
954960
** --no-prompt This option disables prompting the user for input
955961
** and assumes an answer of 'No' for every question.
956962
** --temp Remove only Fossil-generated temporary files.
957963
** -v|--verbose Show all files as they are removed.
964
+** -- Treat all following arguments as files,
965
+** even if they look like flags.
958966
**
959967
** See also: addremove, extras, status
960968
*/
961969
void clean_cmd(void){
962970
int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
@@ -1010,11 +1018,11 @@
10101018
}
10111019
if( zCleanFlag==0 && !verilyFlag ){
10121020
zCleanFlag = db_get("clean-glob", 0);
10131021
}
10141022
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
1015
- verify_all_options();
1023
+ verify_all_options2();
10161024
pIgnore = glob_create(zIgnoreFlag);
10171025
pKeep = glob_create(zKeepFlag);
10181026
pClean = glob_create(zCleanFlag);
10191027
nRoot = (int)strlen(g.zLocalRoot);
10201028
/* Always consider symlinks. */
@@ -1938,12 +1946,12 @@
19381946
19391947
/*
19401948
** COMMAND: ci*
19411949
** COMMAND: commit
19421950
**
1943
-** Usage: %fossil commit ?OPTIONS? ?FILE...?
1944
-** or: %fossil ci ?OPTIONS? ?FILE...?
1951
+** Usage: %fossil commit ?OPTIONS? [--] ?FILE...?
1952
+** or: %fossil ci ?OPTIONS? [--] ?FILE...?
19451953
**
19461954
** Create a new version containing all of the changes in the current
19471955
** checkout. You will be prompted to enter a check-in comment unless
19481956
** the comment has been specified on the command-line using "-m" or a
19491957
** file containing the comment using -M. The editor defined in the
@@ -2020,10 +2028,12 @@
20202028
** --hash verify file status using hashing rather
20212029
** than relying on file mtimes
20222030
** --tag TAG-NAME assign given tag TAG-NAME to the check-in
20232031
** --date-override DATETIME DATE to use instead of 'now'
20242032
** --user-override USER USER to use instead of the current default
2033
+** -- Treat all following arguments as files,
2034
+** even if they look like flags.
20252035
**
20262036
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
20272037
** year-month-day form, it may be truncated, the "T" may be replaced by
20282038
** a space, and it may also name a timezone offset from UTC as "-HH:MM"
20292039
** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2123,11 +2133,11 @@
21232133
db_must_be_within_tree();
21242134
noSign = db_get_boolean("omitsign", 0)|noSign;
21252135
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
21262136
useCksum = db_get_boolean("repo-cksum", 1);
21272137
outputManifest = db_get_manifest_setting();
2128
- verify_all_options();
2138
+ verify_all_options2();
21292139
21302140
/* Get the ID of the parent manifest artifact */
21312141
vid = db_lget_int("checkout", 0);
21322142
if( vid==0 ){
21332143
useCksum = 1;
21342144
--- src/checkin.c
+++ src/checkin.c
@@ -352,11 +352,11 @@
352
353 /*
354 ** COMMAND: changes
355 ** COMMAND: status
356 **
357 ** Usage: %fossil changes|status ?OPTIONS? ?PATHS ...?
358 **
359 ** Report the change status of files in the current checkout. If one or
360 ** more PATHS are specified, only changes among the named files and
361 ** directories are reported. Directories are searched recursively.
362 **
@@ -439,10 +439,12 @@
439 ** --all Display all managed files, i.e. all of the above.
440 ** --extra Display unmanaged files.
441 ** --differ Display modified and extra files.
442 ** --merge Display merge contributors.
443 ** --no-merge Do not display merge contributors.
 
 
444 **
445 ** See also: extras, ls
446 */
447 void status_cmd(void){
448 /* Affirmative and negative flag option tables. */
@@ -526,11 +528,11 @@
526 if( find_option("dotfiles", 0, 0) || db_get_boolean("dotfiles", 0) ){
527 scanFlags = SCAN_ALL;
528 }
529
530 /* We should be done with options. */
531 verify_all_options();
532
533 /* Check for changed files. */
534 vfile_check_signature(vid, useHash ? CKSIG_HASH : 0);
535
536 /* Search for unmanaged files if requested. */
@@ -647,11 +649,11 @@
647 }
648
649 /*
650 ** COMMAND: ls
651 **
652 ** Usage: %fossil ls ?OPTIONS? ?PATHS ...?
653 **
654 ** List all files in the current checkout. If PATHS is included, only the
655 ** named files (or their children if directories) are shown.
656 **
657 ** The ls command is essentially two related commands in one, depending on
@@ -675,10 +677,12 @@
675 ** --age Show when each file was committed.
676 ** -v|--verbose Provide extra information about each file.
677 ** -t Sort output in time order.
678 ** -r VERSION The specific check-in to list.
679 ** -R|--repository FILE Extract info from repository FILE.
 
 
680 **
681 ** See also: changes, extras, status
682 */
683 void ls_cmd(void){
684 int vid;
@@ -700,11 +704,11 @@
700 zRev = find_option("r","r",1);
701 timeOrder = find_option("t","t",0)!=0;
702
703 if( zRev!=0 ){
704 db_find_and_open_repository(0, 0);
705 verify_all_options();
706 ls_cmd_rev(zRev,verboseFlag,showAge,timeOrder);
707 return;
708 }else if( find_option("R",0,1)!=0 ){
709 fossil_fatal("the -r is required in addition to -R");
710 }
@@ -805,11 +809,11 @@
805 }
806
807 /*
808 ** COMMAND: extras
809 **
810 ** Usage: %fossil extras ?OPTIONS? ?PATH1 ...?
811 **
812 ** Print a list of all files in the source tree that are not part of the
813 ** current checkout. See also the "clean" command. If paths are specified,
814 ** only files in the given directories will be listed.
815 **
@@ -829,10 +833,12 @@
829 ** --dotfiles include files beginning with a dot (".")
830 ** --header Identify the repository if there are extras
831 ** --ignore <CSG> ignore files matching patterns from the argument
832 ** --rel-paths Display pathnames relative to the current working
833 ** directory.
 
 
834 **
835 ** See also: changes, clean, status
836 */
837 void extras_cmd(void){
838 Blob report = BLOB_INITIALIZER;
@@ -850,11 +856,11 @@
850 }
851
852 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
853
854 /* We should be done with options.. */
855 verify_all_options();
856
857 if( zIgnoreFlag==0 ){
858 zIgnoreFlag = db_get("ignore-glob", 0);
859 }
860 pIgnore = glob_create(zIgnoreFlag);
@@ -876,11 +882,11 @@
876 }
877
878 /*
879 ** COMMAND: clean
880 **
881 ** Usage: %fossil clean ?OPTIONS? ?PATH ...?
882 **
883 ** Delete all "extra" files in the source tree. "Extra" files are files
884 ** that are not officially part of the checkout. If one or more PATH
885 ** arguments appear, then only the files named, or files contained with
886 ** directories named, will be removed.
@@ -953,10 +959,12 @@
953 ** deleted.
954 ** --no-prompt This option disables prompting the user for input
955 ** and assumes an answer of 'No' for every question.
956 ** --temp Remove only Fossil-generated temporary files.
957 ** -v|--verbose Show all files as they are removed.
 
 
958 **
959 ** See also: addremove, extras, status
960 */
961 void clean_cmd(void){
962 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
@@ -1010,11 +1018,11 @@
1010 }
1011 if( zCleanFlag==0 && !verilyFlag ){
1012 zCleanFlag = db_get("clean-glob", 0);
1013 }
1014 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
1015 verify_all_options();
1016 pIgnore = glob_create(zIgnoreFlag);
1017 pKeep = glob_create(zKeepFlag);
1018 pClean = glob_create(zCleanFlag);
1019 nRoot = (int)strlen(g.zLocalRoot);
1020 /* Always consider symlinks. */
@@ -1938,12 +1946,12 @@
1938
1939 /*
1940 ** COMMAND: ci*
1941 ** COMMAND: commit
1942 **
1943 ** Usage: %fossil commit ?OPTIONS? ?FILE...?
1944 ** or: %fossil ci ?OPTIONS? ?FILE...?
1945 **
1946 ** Create a new version containing all of the changes in the current
1947 ** checkout. You will be prompted to enter a check-in comment unless
1948 ** the comment has been specified on the command-line using "-m" or a
1949 ** file containing the comment using -M. The editor defined in the
@@ -2020,10 +2028,12 @@
2020 ** --hash verify file status using hashing rather
2021 ** than relying on file mtimes
2022 ** --tag TAG-NAME assign given tag TAG-NAME to the check-in
2023 ** --date-override DATETIME DATE to use instead of 'now'
2024 ** --user-override USER USER to use instead of the current default
 
 
2025 **
2026 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2027 ** year-month-day form, it may be truncated, the "T" may be replaced by
2028 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2029 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2123,11 +2133,11 @@
2123 db_must_be_within_tree();
2124 noSign = db_get_boolean("omitsign", 0)|noSign;
2125 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2126 useCksum = db_get_boolean("repo-cksum", 1);
2127 outputManifest = db_get_manifest_setting();
2128 verify_all_options();
2129
2130 /* Get the ID of the parent manifest artifact */
2131 vid = db_lget_int("checkout", 0);
2132 if( vid==0 ){
2133 useCksum = 1;
2134
--- src/checkin.c
+++ src/checkin.c
@@ -352,11 +352,11 @@
352
353 /*
354 ** COMMAND: changes
355 ** COMMAND: status
356 **
357 ** Usage: %fossil changes|status ?OPTIONS? [--] ?PATHS ...?
358 **
359 ** Report the change status of files in the current checkout. If one or
360 ** more PATHS are specified, only changes among the named files and
361 ** directories are reported. Directories are searched recursively.
362 **
@@ -439,10 +439,12 @@
439 ** --all Display all managed files, i.e. all of the above.
440 ** --extra Display unmanaged files.
441 ** --differ Display modified and extra files.
442 ** --merge Display merge contributors.
443 ** --no-merge Do not display merge contributors.
444 ** -- Treat all following arguments as files,
445 ** even if they look like flags.
446 **
447 ** See also: extras, ls
448 */
449 void status_cmd(void){
450 /* Affirmative and negative flag option tables. */
@@ -526,11 +528,11 @@
528 if( find_option("dotfiles", 0, 0) || db_get_boolean("dotfiles", 0) ){
529 scanFlags = SCAN_ALL;
530 }
531
532 /* We should be done with options. */
533 verify_all_options2();
534
535 /* Check for changed files. */
536 vfile_check_signature(vid, useHash ? CKSIG_HASH : 0);
537
538 /* Search for unmanaged files if requested. */
@@ -647,11 +649,11 @@
649 }
650
651 /*
652 ** COMMAND: ls
653 **
654 ** Usage: %fossil ls ?OPTIONS? [--] ?PATHS ...?
655 **
656 ** List all files in the current checkout. If PATHS is included, only the
657 ** named files (or their children if directories) are shown.
658 **
659 ** The ls command is essentially two related commands in one, depending on
@@ -675,10 +677,12 @@
677 ** --age Show when each file was committed.
678 ** -v|--verbose Provide extra information about each file.
679 ** -t Sort output in time order.
680 ** -r VERSION The specific check-in to list.
681 ** -R|--repository FILE Extract info from repository FILE.
682 ** -- Treat all following arguments as files,
683 ** even if they look like flags.
684 **
685 ** See also: changes, extras, status
686 */
687 void ls_cmd(void){
688 int vid;
@@ -700,11 +704,11 @@
704 zRev = find_option("r","r",1);
705 timeOrder = find_option("t","t",0)!=0;
706
707 if( zRev!=0 ){
708 db_find_and_open_repository(0, 0);
709 verify_all_options2();
710 ls_cmd_rev(zRev,verboseFlag,showAge,timeOrder);
711 return;
712 }else if( find_option("R",0,1)!=0 ){
713 fossil_fatal("the -r is required in addition to -R");
714 }
@@ -805,11 +809,11 @@
809 }
810
811 /*
812 ** COMMAND: extras
813 **
814 ** Usage: %fossil extras ?OPTIONS? [--] ?PATH1 ...?
815 **
816 ** Print a list of all files in the source tree that are not part of the
817 ** current checkout. See also the "clean" command. If paths are specified,
818 ** only files in the given directories will be listed.
819 **
@@ -829,10 +833,12 @@
833 ** --dotfiles include files beginning with a dot (".")
834 ** --header Identify the repository if there are extras
835 ** --ignore <CSG> ignore files matching patterns from the argument
836 ** --rel-paths Display pathnames relative to the current working
837 ** directory.
838 ** -- Treat all following arguments as files,
839 ** even if they look like flags.
840 **
841 ** See also: changes, clean, status
842 */
843 void extras_cmd(void){
844 Blob report = BLOB_INITIALIZER;
@@ -850,11 +856,11 @@
856 }
857
858 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
859
860 /* We should be done with options.. */
861 verify_all_options2();
862
863 if( zIgnoreFlag==0 ){
864 zIgnoreFlag = db_get("ignore-glob", 0);
865 }
866 pIgnore = glob_create(zIgnoreFlag);
@@ -876,11 +882,11 @@
882 }
883
884 /*
885 ** COMMAND: clean
886 **
887 ** Usage: %fossil clean ?OPTIONS? [--] ?PATH ...?
888 **
889 ** Delete all "extra" files in the source tree. "Extra" files are files
890 ** that are not officially part of the checkout. If one or more PATH
891 ** arguments appear, then only the files named, or files contained with
892 ** directories named, will be removed.
@@ -953,10 +959,12 @@
959 ** deleted.
960 ** --no-prompt This option disables prompting the user for input
961 ** and assumes an answer of 'No' for every question.
962 ** --temp Remove only Fossil-generated temporary files.
963 ** -v|--verbose Show all files as they are removed.
964 ** -- Treat all following arguments as files,
965 ** even if they look like flags.
966 **
967 ** See also: addremove, extras, status
968 */
969 void clean_cmd(void){
970 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
@@ -1010,11 +1018,11 @@
1018 }
1019 if( zCleanFlag==0 && !verilyFlag ){
1020 zCleanFlag = db_get("clean-glob", 0);
1021 }
1022 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
1023 verify_all_options2();
1024 pIgnore = glob_create(zIgnoreFlag);
1025 pKeep = glob_create(zKeepFlag);
1026 pClean = glob_create(zCleanFlag);
1027 nRoot = (int)strlen(g.zLocalRoot);
1028 /* Always consider symlinks. */
@@ -1938,12 +1946,12 @@
1946
1947 /*
1948 ** COMMAND: ci*
1949 ** COMMAND: commit
1950 **
1951 ** Usage: %fossil commit ?OPTIONS? [--] ?FILE...?
1952 ** or: %fossil ci ?OPTIONS? [--] ?FILE...?
1953 **
1954 ** Create a new version containing all of the changes in the current
1955 ** checkout. You will be prompted to enter a check-in comment unless
1956 ** the comment has been specified on the command-line using "-m" or a
1957 ** file containing the comment using -M. The editor defined in the
@@ -2020,10 +2028,12 @@
2028 ** --hash verify file status using hashing rather
2029 ** than relying on file mtimes
2030 ** --tag TAG-NAME assign given tag TAG-NAME to the check-in
2031 ** --date-override DATETIME DATE to use instead of 'now'
2032 ** --user-override USER USER to use instead of the current default
2033 ** -- Treat all following arguments as files,
2034 ** even if they look like flags.
2035 **
2036 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
2037 ** year-month-day form, it may be truncated, the "T" may be replaced by
2038 ** a space, and it may also name a timezone offset from UTC as "-HH:MM"
2039 ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z"
@@ -2123,11 +2133,11 @@
2133 db_must_be_within_tree();
2134 noSign = db_get_boolean("omitsign", 0)|noSign;
2135 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2136 useCksum = db_get_boolean("repo-cksum", 1);
2137 outputManifest = db_get_manifest_setting();
2138 verify_all_options2();
2139
2140 /* Get the ID of the parent manifest artifact */
2141 vid = db_lget_int("checkout", 0);
2142 if( vid==0 ){
2143 useCksum = 1;
2144

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button