Fossil SCM

Revise (and hopefully improve) the on-line documentation for "fossil clean". Strengthen the --verily option to "fossil clean" so that it overrides all other options and settings (including --keep and --ignore) and silently deletes *all* unmanaged files (as a proper "clean" ought).

drh 2015-04-28 17:34 trunk
Commit c353ee8f9ca66f99984036b926dc8cb10c03714c
1 file changed +27 -22
+27 -22
--- src/checkin.c
+++ src/checkin.c
@@ -617,30 +617,29 @@
617617
db_finalize(&q);
618618
}
619619
620620
/*
621621
** COMMAND: clean
622
-** Usage: %fossil clean ?OPTIONS? ?PATH1 ...?
622
+** Usage: %fossil clean ?OPTIONS? ?PATH ...?
623623
**
624624
** Delete all "extra" files in the source tree. "Extra" files are
625625
** files that are not officially part of the checkout. This operation
626
-** cannot be undone. If paths are specified, only the directories or
627
-** files specified will be considered for cleaning.
628
-**
629
-** You will be prompted before removing each eligible file unless the
630
-** --force flag is in use or it matches the --clean option. The
631
-** GLOBPATTERN specified by the "ignore-glob" setting is used if the
632
-** --ignore option is omitted, the same with "clean-glob" and --clean
633
-** as well as "keep-glob" and --keep. If you are sure you wish to
634
-** remove all "extra" files except the ones specified with --ignore
635
-** and --keep, you can specify the optional -f|--force flag and no
636
-** prompts will be issued. If a file matches both --keep and --clean,
637
-** --keep takes precedence.
638
-**
639
-** Files and subdirectories whose names begin with "." are
640
-** normally kept. They are handled if the "--dotfiles" option
641
-** is used.
626
+** cannot be undone. If one or more PATH arguments appear, then only
627
+** the files named, or files contained with directories named, will be
628
+** removed.
629
+**
630
+** Prompted are issued to confirm the removal of each file, unless
631
+** the --force or --verily flag is used or unless the file matches
632
+** glob pattern specified by the --clean option. No file that matches
633
+** glob patterns specified by --ignore or --keep will ever be deleted.
634
+** The default values for --clean, --ignore, and --keep are determined
635
+** by the (versionable) clean-glob, ignore-glob, and keep-glob settings.
636
+** Files and subdirectories whose names begin with "." are automatically
637
+** ignored unless the --dotfiles option is used.
638
+**
639
+** The --verily option overrides all other options and settings and
640
+** deletes all unmanaged files and empty directories without prompting.
642641
**
643642
** Options:
644643
** --allckouts Check for empty directories within any checkouts
645644
** that may be nested within the current one. This
646645
** option should be used with great care because the
@@ -658,11 +657,13 @@
658657
** argument. Matching files, if any, are removed
659658
** prior to checking for any empty directories;
660659
** therefore, directories that contain only files
661660
** that were removed will be removed as well.
662661
** -f|--force Remove files without prompting.
663
-** --verily Shorthand for: -f --emptydirs --dotfiles
662
+** --verily Remove everything that is not a managed file or
663
+** the repository itself. Imples -f --emptydirs
664
+** --dotfiles --ignore '' --keep ''.
664665
** --clean <CSG> Never prompt for files matching this
665666
** comma separated list of glob patterns.
666667
** --ignore <CSG> Ignore files matching patterns from the
667668
** comma separated list of glob patterns.
668669
** --keep <CSG> Keep files matching this comma separated
@@ -675,10 +676,11 @@
675676
*/
676677
void clean_cmd(void){
677678
int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
678679
int emptyDirsFlag, dirsOnlyFlag;
679680
unsigned scanFlags = 0;
681
+ int verilyFlag = 0;
680682
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
681683
Glob *pIgnore, *pKeep, *pClean;
682684
int nRoot;
683685
684686
dryRunFlag = find_option("dry-run","n",0)!=0;
@@ -698,21 +700,24 @@
698700
verboseFlag = find_option("verbose","v",0)!=0;
699701
zKeepFlag = find_option("keep",0,1);
700702
zCleanFlag = find_option("clean",0,1);
701703
db_must_be_within_tree();
702704
if( find_option("verily",0,0)!=0 ){
703
- allFileFlag = allDirFlag = 1;
705
+ verilyFlag = allFileFlag = allDirFlag = 1;
704706
emptyDirsFlag = 1;
705707
scanFlags |= SCAN_ALL;
708
+ zKeepFlag = 0;
709
+ zIgnoreFlag = 0;
710
+ zCleanFlag = 0;
706711
}
707
- if( zIgnoreFlag==0 ){
712
+ if( zIgnoreFlag==0 && !verilyFlag ){
708713
zIgnoreFlag = db_get("ignore-glob", 0);
709714
}
710
- if( zKeepFlag==0 ){
715
+ if( zKeepFlag==0 && !verilyFlag ){
711716
zKeepFlag = db_get("keep-glob", 0);
712717
}
713
- if( zCleanFlag==0 ){
718
+ if( zCleanFlag==0 && !verilyFlag ){
714719
zCleanFlag = db_get("clean-glob", 0);
715720
}
716721
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
717722
verify_all_options();
718723
pIgnore = glob_create(zIgnoreFlag);
719724
--- src/checkin.c
+++ src/checkin.c
@@ -617,30 +617,29 @@
617 db_finalize(&q);
618 }
619
620 /*
621 ** COMMAND: clean
622 ** Usage: %fossil clean ?OPTIONS? ?PATH1 ...?
623 **
624 ** Delete all "extra" files in the source tree. "Extra" files are
625 ** files that are not officially part of the checkout. This operation
626 ** cannot be undone. If paths are specified, only the directories or
627 ** files specified will be considered for cleaning.
628 **
629 ** You will be prompted before removing each eligible file unless the
630 ** --force flag is in use or it matches the --clean option. The
631 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
632 ** --ignore option is omitted, the same with "clean-glob" and --clean
633 ** as well as "keep-glob" and --keep. If you are sure you wish to
634 ** remove all "extra" files except the ones specified with --ignore
635 ** and --keep, you can specify the optional -f|--force flag and no
636 ** prompts will be issued. If a file matches both --keep and --clean,
637 ** --keep takes precedence.
638 **
639 ** Files and subdirectories whose names begin with "." are
640 ** normally kept. They are handled if the "--dotfiles" option
641 ** is used.
642 **
643 ** Options:
644 ** --allckouts Check for empty directories within any checkouts
645 ** that may be nested within the current one. This
646 ** option should be used with great care because the
@@ -658,11 +657,13 @@
658 ** argument. Matching files, if any, are removed
659 ** prior to checking for any empty directories;
660 ** therefore, directories that contain only files
661 ** that were removed will be removed as well.
662 ** -f|--force Remove files without prompting.
663 ** --verily Shorthand for: -f --emptydirs --dotfiles
 
 
664 ** --clean <CSG> Never prompt for files matching this
665 ** comma separated list of glob patterns.
666 ** --ignore <CSG> Ignore files matching patterns from the
667 ** comma separated list of glob patterns.
668 ** --keep <CSG> Keep files matching this comma separated
@@ -675,10 +676,11 @@
675 */
676 void clean_cmd(void){
677 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
678 int emptyDirsFlag, dirsOnlyFlag;
679 unsigned scanFlags = 0;
 
680 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
681 Glob *pIgnore, *pKeep, *pClean;
682 int nRoot;
683
684 dryRunFlag = find_option("dry-run","n",0)!=0;
@@ -698,21 +700,24 @@
698 verboseFlag = find_option("verbose","v",0)!=0;
699 zKeepFlag = find_option("keep",0,1);
700 zCleanFlag = find_option("clean",0,1);
701 db_must_be_within_tree();
702 if( find_option("verily",0,0)!=0 ){
703 allFileFlag = allDirFlag = 1;
704 emptyDirsFlag = 1;
705 scanFlags |= SCAN_ALL;
 
 
 
706 }
707 if( zIgnoreFlag==0 ){
708 zIgnoreFlag = db_get("ignore-glob", 0);
709 }
710 if( zKeepFlag==0 ){
711 zKeepFlag = db_get("keep-glob", 0);
712 }
713 if( zCleanFlag==0 ){
714 zCleanFlag = db_get("clean-glob", 0);
715 }
716 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
717 verify_all_options();
718 pIgnore = glob_create(zIgnoreFlag);
719
--- src/checkin.c
+++ src/checkin.c
@@ -617,30 +617,29 @@
617 db_finalize(&q);
618 }
619
620 /*
621 ** COMMAND: clean
622 ** Usage: %fossil clean ?OPTIONS? ?PATH ...?
623 **
624 ** Delete all "extra" files in the source tree. "Extra" files are
625 ** files that are not officially part of the checkout. This operation
626 ** cannot be undone. If one or more PATH arguments appear, then only
627 ** the files named, or files contained with directories named, will be
628 ** removed.
629 **
630 ** Prompted are issued to confirm the removal of each file, unless
631 ** the --force or --verily flag is used or unless the file matches
632 ** glob pattern specified by the --clean option. No file that matches
633 ** glob patterns specified by --ignore or --keep will ever be deleted.
634 ** The default values for --clean, --ignore, and --keep are determined
635 ** by the (versionable) clean-glob, ignore-glob, and keep-glob settings.
636 ** Files and subdirectories whose names begin with "." are automatically
637 ** ignored unless the --dotfiles option is used.
638 **
639 ** The --verily option overrides all other options and settings and
640 ** deletes all unmanaged files and empty directories without prompting.
 
641 **
642 ** Options:
643 ** --allckouts Check for empty directories within any checkouts
644 ** that may be nested within the current one. This
645 ** option should be used with great care because the
@@ -658,11 +657,13 @@
657 ** argument. Matching files, if any, are removed
658 ** prior to checking for any empty directories;
659 ** therefore, directories that contain only files
660 ** that were removed will be removed as well.
661 ** -f|--force Remove files without prompting.
662 ** --verily Remove everything that is not a managed file or
663 ** the repository itself. Imples -f --emptydirs
664 ** --dotfiles --ignore '' --keep ''.
665 ** --clean <CSG> Never prompt for files matching this
666 ** comma separated list of glob patterns.
667 ** --ignore <CSG> Ignore files matching patterns from the
668 ** comma separated list of glob patterns.
669 ** --keep <CSG> Keep files matching this comma separated
@@ -675,10 +676,11 @@
676 */
677 void clean_cmd(void){
678 int allFileFlag, allDirFlag, dryRunFlag, verboseFlag;
679 int emptyDirsFlag, dirsOnlyFlag;
680 unsigned scanFlags = 0;
681 int verilyFlag = 0;
682 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
683 Glob *pIgnore, *pKeep, *pClean;
684 int nRoot;
685
686 dryRunFlag = find_option("dry-run","n",0)!=0;
@@ -698,21 +700,24 @@
700 verboseFlag = find_option("verbose","v",0)!=0;
701 zKeepFlag = find_option("keep",0,1);
702 zCleanFlag = find_option("clean",0,1);
703 db_must_be_within_tree();
704 if( find_option("verily",0,0)!=0 ){
705 verilyFlag = allFileFlag = allDirFlag = 1;
706 emptyDirsFlag = 1;
707 scanFlags |= SCAN_ALL;
708 zKeepFlag = 0;
709 zIgnoreFlag = 0;
710 zCleanFlag = 0;
711 }
712 if( zIgnoreFlag==0 && !verilyFlag ){
713 zIgnoreFlag = db_get("ignore-glob", 0);
714 }
715 if( zKeepFlag==0 && !verilyFlag ){
716 zKeepFlag = db_get("keep-glob", 0);
717 }
718 if( zCleanFlag==0 && !verilyFlag ){
719 zCleanFlag = db_get("clean-glob", 0);
720 }
721 if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
722 verify_all_options();
723 pIgnore = glob_create(zIgnoreFlag);
724

Keyboard Shortcuts

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