Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the -i or --prompt option to the "fossil clean" command. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | clean-cmd-cleanup |
Files: | files | file ages | folders |
SHA1: |
1c9da04a39c9b06f4efcee7264b309d9 |
User & Date: | drh 2015-11-03 01:07:58 |
Context
2015-11-03
| ||
01:20 | Always print a warning if "fossil clean" is unable to remove a file, even if the --verbose option is omitted. ... (Closed-Leaf check-in: 6c2a2087 user: drh tags: clean-cmd-cleanup) | |
01:07 | Add the -i or --prompt option to the "fossil clean" command. ... (check-in: 1c9da04a user: drh tags: clean-cmd-cleanup) | |
00:46 | Fix over-length source code lines and memory leaks in the “clean” command. ... (check-in: 4c8b1e81 user: drh tags: clean-cmd-cleanup) | |
Changes
Changes to src/checkin.c.
︙ | ︙ | |||
672 673 674 675 676 677 678 679 680 681 682 683 684 685 | ** explicitly exempted via the empty-dirs setting ** or another applicable setting or command line ** argument. Matching files, if any, are removed ** prior to checking for any empty directories; ** therefore, directories that contain only files ** that were removed will be removed as well. ** -f|--force Remove files without prompting. ** -x|--verily WARNING: Removes everything that is not a managed ** file or the repository itself. This option ** implies the --force, --emptydirs, --dotfiles, and ** --disable-undo options. Furthermore, it completely ** disregards the keep-glob and ignore-glob settings. ** However, it does honor the --ignore and --keep ** options. | > | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | ** explicitly exempted via the empty-dirs setting ** or another applicable setting or command line ** argument. Matching files, if any, are removed ** prior to checking for any empty directories; ** therefore, directories that contain only files ** that were removed will be removed as well. ** -f|--force Remove files without prompting. ** -i|--prompt Prompt before removing each file. ** -x|--verily WARNING: Removes everything that is not a managed ** file or the repository itself. This option ** implies the --force, --emptydirs, --dotfiles, and ** --disable-undo options. Furthermore, it completely ** disregards the keep-glob and ignore-glob settings. ** However, it does honor the --ignore and --keep ** options. |
︙ | ︙ | |||
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | ** ** See also: addremove, extras, status */ void clean_cmd(void){ int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; int emptyDirsFlag, dirsOnlyFlag; int disableUndo, noPrompt; unsigned scanFlags = 0; int verilyFlag = 0; const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; Glob *pIgnore, *pKeep, *pClean; int nRoot; #ifndef UNDO_SIZE_LIMIT /* TODO: Setting? */ #define UNDO_SIZE_LIMIT (10*1024*1024) /* 10MiB */ #endif undo_capture_command_line(); dryRunFlag = find_option("dry-run","n",0)!=0; if( !dryRunFlag ){ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ } if( !dryRunFlag ){ dryRunFlag = find_option("whatif",0,0)!=0; } disableUndo = find_option("disable-undo",0,0)!=0; noPrompt = find_option("no-prompt",0,0)!=0; allFileFlag = allDirFlag = find_option("force","f",0)!=0; dirsOnlyFlag = find_option("dirsonly",0,0)!=0; emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; zIgnoreFlag = find_option("ignore",0,1); | > > | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | ** ** See also: addremove, extras, status */ void clean_cmd(void){ int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; int emptyDirsFlag, dirsOnlyFlag; int disableUndo, noPrompt; int alwaysPrompt = 0; unsigned scanFlags = 0; int verilyFlag = 0; const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; Glob *pIgnore, *pKeep, *pClean; int nRoot; #ifndef UNDO_SIZE_LIMIT /* TODO: Setting? */ #define UNDO_SIZE_LIMIT (10*1024*1024) /* 10MiB */ #endif undo_capture_command_line(); dryRunFlag = find_option("dry-run","n",0)!=0; if( !dryRunFlag ){ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ } if( !dryRunFlag ){ dryRunFlag = find_option("whatif",0,0)!=0; } disableUndo = find_option("disable-undo",0,0)!=0; noPrompt = find_option("no-prompt",0,0)!=0; alwaysPrompt = find_option("prompt","i",0)!=0; allFileFlag = allDirFlag = find_option("force","f",0)!=0; dirsOnlyFlag = find_option("dirsonly",0,0)!=0; emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; zIgnoreFlag = find_option("ignore",0,1); |
︙ | ︙ | |||
779 780 781 782 783 784 785 786 | if( verboseFlag ){ fossil_print("KEPT file \"%s\" not removed (due to --keep" " or \"keep-glob\")\n", zName+nRoot); } continue; } if( !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ int undoRc = UNDO_NONE; | > > > > > > > > > > > > > > > > > | < | | | | | | > < | 782 783 784 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 827 828 829 | if( verboseFlag ){ fossil_print("KEPT file \"%s\" not removed (due to --keep" " or \"keep-glob\")\n", zName+nRoot); } continue; } if( !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ char *zPrompt = 0; char cReply; Blob ans = empty_blob; int undoRc = UNDO_NONE; if( alwaysPrompt ){ zPrompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", zName+nRoot); prompt_user(zPrompt, &ans); fossil_free(zPrompt); cReply = fossil_toupper(blob_str(&ans)[0]); blob_reset(&ans); if( cReply=='N' ) continue; if( cReply=='A' ){ allFileFlag = 1; alwaysPrompt = 0; }else{ undoRc = UNDO_SAVED_OK; } }else if( !disableUndo ){ undoRc = undo_maybe_save(zName+nRoot, UNDO_SIZE_LIMIT); } if( undoRc!=UNDO_SAVED_OK ){ if( allFileFlag ){ cReply = 'Y'; }else if( !noPrompt ){ Blob ans; zPrompt = mprintf("\nWARNING: Deletion of this file will " "not be undoable via the 'undo'\n" " command because %s.\n\n" "Remove unmanaged file \"%s\" (a=all/y/N)? ", undo_save_message(undoRc), zName+nRoot); prompt_user(zPrompt, &ans); fossil_free(zPrompt); cReply = blob_str(&ans)[0]; blob_reset(&ans); }else{ cReply = 'N'; } if( cReply=='a' || cReply=='A' ){ allFileFlag = 1; }else if( cReply!='y' && cReply!='Y' ){ |
︙ | ︙ |