Fossil SCM
If "fossil clean" is undoable, there is no need to prompt for each file first.
Commit
466ccf96c6a528a76c69379a833a20597c403c69
Parent
cc34dcb747cd91b…
1 file changed
+7
-19
+7
-19
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -668,11 +668,11 @@ | ||
| 668 | 668 | ** or another applicable setting or command line |
| 669 | 669 | ** argument. Matching files, if any, are removed |
| 670 | 670 | ** prior to checking for any empty directories; |
| 671 | 671 | ** therefore, directories that contain only files |
| 672 | 672 | ** that were removed will be removed as well. |
| 673 | -** -f|--force Remove files without prompting. | |
| 673 | +** -f|--force Remove directories without prompting. | |
| 674 | 674 | ** -x|--verily Remove everything that is not a managed file or |
| 675 | 675 | ** the repository itself. Implies -f --emptydirs |
| 676 | 676 | ** --dotfiles. Disregard keep-glob and ignore-glob, |
| 677 | 677 | ** except that files matching ignore-glob are not |
| 678 | 678 | ** never undo-able. |
| @@ -688,11 +688,11 @@ | ||
| 688 | 688 | ** -v|--verbose Show all files as they are removed. |
| 689 | 689 | ** |
| 690 | 690 | ** See also: addremove, extras, status |
| 691 | 691 | */ |
| 692 | 692 | void clean_cmd(void){ |
| 693 | - int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, forceFlag; | |
| 693 | + int allDirFlag, dryRunFlag, verboseFlag; | |
| 694 | 694 | int emptyDirsFlag, dirsOnlyFlag; |
| 695 | 695 | unsigned scanFlags = 0; |
| 696 | 696 | int verilyFlag = 0; |
| 697 | 697 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 698 | 698 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -703,11 +703,11 @@ | ||
| 703 | 703 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 704 | 704 | } |
| 705 | 705 | if( !dryRunFlag ){ |
| 706 | 706 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 707 | 707 | } |
| 708 | - allFileFlag = allDirFlag = forceFlag = find_option("force","f",0)!=0; | |
| 708 | + allDirFlag = find_option("force","f",0)!=0; | |
| 709 | 709 | if( !dryRunFlag ){ |
| 710 | 710 | undo_capture_command_line(); |
| 711 | 711 | } |
| 712 | 712 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 713 | 713 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| @@ -718,11 +718,11 @@ | ||
| 718 | 718 | verboseFlag = find_option("verbose","v",0)!=0; |
| 719 | 719 | zKeepFlag = find_option("keep",0,1); |
| 720 | 720 | zCleanFlag = find_option("clean",0,1); |
| 721 | 721 | db_must_be_within_tree(); |
| 722 | 722 | if( find_option("verily","x",0)!=0 ){ |
| 723 | - verilyFlag = allFileFlag = allDirFlag = 1; | |
| 723 | + verilyFlag = allDirFlag = 1; | |
| 724 | 724 | emptyDirsFlag = 1; |
| 725 | 725 | scanFlags |= SCAN_ALL; |
| 726 | 726 | zCleanFlag = 0; |
| 727 | 727 | } |
| 728 | 728 | if( zIgnoreFlag==0 ){ |
| @@ -739,11 +739,11 @@ | ||
| 739 | 739 | pIgnore = glob_create(zIgnoreFlag); |
| 740 | 740 | pKeep = glob_create(zKeepFlag); |
| 741 | 741 | pClean = glob_create(zCleanFlag); |
| 742 | 742 | nRoot = (int)strlen(g.zLocalRoot); |
| 743 | 743 | g.allowSymlinks = 1; /* Find symlinks too */ |
| 744 | - if( !forceFlag && !dryRunFlag ) undo_begin(); | |
| 744 | + if( !dryRunFlag ) undo_begin(); | |
| 745 | 745 | if( !dirsOnlyFlag ){ |
| 746 | 746 | Stmt q; |
| 747 | 747 | Blob repo; |
| 748 | 748 | char cReply; |
| 749 | 749 | Blob ans; |
| @@ -767,24 +767,12 @@ | ||
| 767 | 767 | fossil_print("KEPT file \"%s\" not removed (due to --keep" |
| 768 | 768 | " or \"keep-glob\")\n", zName+nRoot); |
| 769 | 769 | } |
| 770 | 770 | continue; |
| 771 | 771 | } |
| 772 | - if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ | |
| 773 | - prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", | |
| 774 | - zName+nRoot); | |
| 775 | - prompt_user(prompt, &ans); | |
| 776 | - cReply = blob_str(&ans)[0]; | |
| 777 | - if( cReply=='a' || cReply=='A' ){ | |
| 778 | - allFileFlag = 1; | |
| 779 | - }else if( cReply!='y' && cReply!='Y' ){ | |
| 780 | - blob_reset(&ans); | |
| 781 | - continue; | |
| 782 | - } | |
| 783 | - blob_reset(&ans); | |
| 784 | - } | |
| 785 | - if( !dryRunFlag && !(verilyFlag && glob_match(pIgnore, zName+nRoot)) | |
| 772 | + if( !dryRunFlag && !glob_match(pClean, zName+nRoot) | |
| 773 | + && !(verilyFlag && glob_match(pIgnore, zName+nRoot)) | |
| 786 | 774 | && undo_save(zName+nRoot, 10*1024*1024) ){ |
| 787 | 775 | prompt = mprintf("file \"%s\" too big. Deletion will not be " |
| 788 | 776 | "undo-able. Continue (y/N)? ", zName+nRoot); |
| 789 | 777 | blob_zero(&ans); |
| 790 | 778 | prompt_user(prompt, &ans); |
| 791 | 779 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -668,11 +668,11 @@ | |
| 668 | ** or another applicable setting or command line |
| 669 | ** argument. Matching files, if any, are removed |
| 670 | ** prior to checking for any empty directories; |
| 671 | ** therefore, directories that contain only files |
| 672 | ** that were removed will be removed as well. |
| 673 | ** -f|--force Remove files without prompting. |
| 674 | ** -x|--verily Remove everything that is not a managed file or |
| 675 | ** the repository itself. Implies -f --emptydirs |
| 676 | ** --dotfiles. Disregard keep-glob and ignore-glob, |
| 677 | ** except that files matching ignore-glob are not |
| 678 | ** never undo-able. |
| @@ -688,11 +688,11 @@ | |
| 688 | ** -v|--verbose Show all files as they are removed. |
| 689 | ** |
| 690 | ** See also: addremove, extras, status |
| 691 | */ |
| 692 | void clean_cmd(void){ |
| 693 | int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, forceFlag; |
| 694 | int emptyDirsFlag, dirsOnlyFlag; |
| 695 | unsigned scanFlags = 0; |
| 696 | int verilyFlag = 0; |
| 697 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 698 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -703,11 +703,11 @@ | |
| 703 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 704 | } |
| 705 | if( !dryRunFlag ){ |
| 706 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 707 | } |
| 708 | allFileFlag = allDirFlag = forceFlag = find_option("force","f",0)!=0; |
| 709 | if( !dryRunFlag ){ |
| 710 | undo_capture_command_line(); |
| 711 | } |
| 712 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 713 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| @@ -718,11 +718,11 @@ | |
| 718 | verboseFlag = find_option("verbose","v",0)!=0; |
| 719 | zKeepFlag = find_option("keep",0,1); |
| 720 | zCleanFlag = find_option("clean",0,1); |
| 721 | db_must_be_within_tree(); |
| 722 | if( find_option("verily","x",0)!=0 ){ |
| 723 | verilyFlag = allFileFlag = allDirFlag = 1; |
| 724 | emptyDirsFlag = 1; |
| 725 | scanFlags |= SCAN_ALL; |
| 726 | zCleanFlag = 0; |
| 727 | } |
| 728 | if( zIgnoreFlag==0 ){ |
| @@ -739,11 +739,11 @@ | |
| 739 | pIgnore = glob_create(zIgnoreFlag); |
| 740 | pKeep = glob_create(zKeepFlag); |
| 741 | pClean = glob_create(zCleanFlag); |
| 742 | nRoot = (int)strlen(g.zLocalRoot); |
| 743 | g.allowSymlinks = 1; /* Find symlinks too */ |
| 744 | if( !forceFlag && !dryRunFlag ) undo_begin(); |
| 745 | if( !dirsOnlyFlag ){ |
| 746 | Stmt q; |
| 747 | Blob repo; |
| 748 | char cReply; |
| 749 | Blob ans; |
| @@ -767,24 +767,12 @@ | |
| 767 | fossil_print("KEPT file \"%s\" not removed (due to --keep" |
| 768 | " or \"keep-glob\")\n", zName+nRoot); |
| 769 | } |
| 770 | continue; |
| 771 | } |
| 772 | if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 773 | prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 774 | zName+nRoot); |
| 775 | prompt_user(prompt, &ans); |
| 776 | cReply = blob_str(&ans)[0]; |
| 777 | if( cReply=='a' || cReply=='A' ){ |
| 778 | allFileFlag = 1; |
| 779 | }else if( cReply!='y' && cReply!='Y' ){ |
| 780 | blob_reset(&ans); |
| 781 | continue; |
| 782 | } |
| 783 | blob_reset(&ans); |
| 784 | } |
| 785 | if( !dryRunFlag && !(verilyFlag && glob_match(pIgnore, zName+nRoot)) |
| 786 | && undo_save(zName+nRoot, 10*1024*1024) ){ |
| 787 | prompt = mprintf("file \"%s\" too big. Deletion will not be " |
| 788 | "undo-able. Continue (y/N)? ", zName+nRoot); |
| 789 | blob_zero(&ans); |
| 790 | prompt_user(prompt, &ans); |
| 791 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -668,11 +668,11 @@ | |
| 668 | ** or another applicable setting or command line |
| 669 | ** argument. Matching files, if any, are removed |
| 670 | ** prior to checking for any empty directories; |
| 671 | ** therefore, directories that contain only files |
| 672 | ** that were removed will be removed as well. |
| 673 | ** -f|--force Remove directories without prompting. |
| 674 | ** -x|--verily Remove everything that is not a managed file or |
| 675 | ** the repository itself. Implies -f --emptydirs |
| 676 | ** --dotfiles. Disregard keep-glob and ignore-glob, |
| 677 | ** except that files matching ignore-glob are not |
| 678 | ** never undo-able. |
| @@ -688,11 +688,11 @@ | |
| 688 | ** -v|--verbose Show all files as they are removed. |
| 689 | ** |
| 690 | ** See also: addremove, extras, status |
| 691 | */ |
| 692 | void clean_cmd(void){ |
| 693 | int allDirFlag, dryRunFlag, verboseFlag; |
| 694 | int emptyDirsFlag, dirsOnlyFlag; |
| 695 | unsigned scanFlags = 0; |
| 696 | int verilyFlag = 0; |
| 697 | const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; |
| 698 | Glob *pIgnore, *pKeep, *pClean; |
| @@ -703,11 +703,11 @@ | |
| 703 | dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ |
| 704 | } |
| 705 | if( !dryRunFlag ){ |
| 706 | dryRunFlag = find_option("whatif",0,0)!=0; |
| 707 | } |
| 708 | allDirFlag = find_option("force","f",0)!=0; |
| 709 | if( !dryRunFlag ){ |
| 710 | undo_capture_command_line(); |
| 711 | } |
| 712 | dirsOnlyFlag = find_option("dirsonly",0,0)!=0; |
| 713 | emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; |
| @@ -718,11 +718,11 @@ | |
| 718 | verboseFlag = find_option("verbose","v",0)!=0; |
| 719 | zKeepFlag = find_option("keep",0,1); |
| 720 | zCleanFlag = find_option("clean",0,1); |
| 721 | db_must_be_within_tree(); |
| 722 | if( find_option("verily","x",0)!=0 ){ |
| 723 | verilyFlag = allDirFlag = 1; |
| 724 | emptyDirsFlag = 1; |
| 725 | scanFlags |= SCAN_ALL; |
| 726 | zCleanFlag = 0; |
| 727 | } |
| 728 | if( zIgnoreFlag==0 ){ |
| @@ -739,11 +739,11 @@ | |
| 739 | pIgnore = glob_create(zIgnoreFlag); |
| 740 | pKeep = glob_create(zKeepFlag); |
| 741 | pClean = glob_create(zCleanFlag); |
| 742 | nRoot = (int)strlen(g.zLocalRoot); |
| 743 | g.allowSymlinks = 1; /* Find symlinks too */ |
| 744 | if( !dryRunFlag ) undo_begin(); |
| 745 | if( !dirsOnlyFlag ){ |
| 746 | Stmt q; |
| 747 | Blob repo; |
| 748 | char cReply; |
| 749 | Blob ans; |
| @@ -767,24 +767,12 @@ | |
| 767 | fossil_print("KEPT file \"%s\" not removed (due to --keep" |
| 768 | " or \"keep-glob\")\n", zName+nRoot); |
| 769 | } |
| 770 | continue; |
| 771 | } |
| 772 | if( !dryRunFlag && !glob_match(pClean, zName+nRoot) |
| 773 | && !(verilyFlag && glob_match(pIgnore, zName+nRoot)) |
| 774 | && undo_save(zName+nRoot, 10*1024*1024) ){ |
| 775 | prompt = mprintf("file \"%s\" too big. Deletion will not be " |
| 776 | "undo-able. Continue (y/N)? ", zName+nRoot); |
| 777 | blob_zero(&ans); |
| 778 | prompt_user(prompt, &ans); |
| 779 |