Fossil

Check-in [7695a718]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:With 'fossil clean -x', prompt for any files not matching any of --ignore/--clean/--keep. This is actually what gives 'fossil clean -x' added value above 'fossil clean --ignore ""'.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | cleanX
Files: files | file ages | folders
SHA1:7695a718bee7275c02ec864b41e4c053e1e30222
User & Date: jan.nijtmans 2014-03-27 09:36:37
Context
2014-04-24
08:12
merge trunk check-in: 9d969db8 user: jan.nijtmans tags: cleanX
2014-03-27
09:36
With 'fossil clean -x', prompt for any files not matching any of --ignore/--clean/--keep. This is actually what gives 'fossil clean -x' added value above 'fossil clean --ignore ""'. check-in: 7695a718 user: jan.nijtmans tags: cleanX
09:06
merge trunk check-in: a40d3f90 user: jan.nijtmans tags: cleanX
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
...
625
626
627
628
629
630
631
632

633
634
635
636
637
638
639
...
670
671
672
673
674
675
676
677

678
679
680
681
682
683
684
**                     comma separated list of glob patterns.
**    --keep <CSG>     Keep files matching this comma separated
**                     list of glob patterns.
**    -n|--dry-run     If given, display instead of run actions.
**    --temp           Remove only Fossil-generated temporary files.
**    -v|--verbose     Show all files as they are removed.
**    -x|--extreme     Remove all files not part of the current
**                     checkout, without taking into consideration
**                     the "ignore-glob" setting and the --ignore
**                     command line option.
**                     Compatibile with "git clean -x".
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
  int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
  int emptyDirsFlag, dirsOnlyFlag;
................................................................................
    );
    if( file_tree_name(g.zRepositoryName, &repo, 0) ){
      db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
    }
    db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
    while( db_step(&q)==SQLITE_ROW ){
      const char *zName = db_column_text(&q, 0);
      if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){

        Blob ans;
        char cReply;
        int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
        char *prompt = mprintf("%sRemove %s file \"%s\" (a=all/y/N)? ",
                               matchIgnore ? "WARNING: " : "",
                               matchIgnore ? "\"IGNORED\"" : "unmanaged",
                               zName+nRoot);
................................................................................
        "SELECT %Q || x FROM dscan_temp"
        " WHERE x NOT IN (%s) AND y = 0"
        " ORDER BY 1 DESC",
        g.zLocalRoot, fossil_all_reserved_names(0)
    );
    while( db_step(&q)==SQLITE_ROW ){
      const char *zName = db_column_text(&q, 0);
      if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){

        Blob ans;
        char cReply;
        int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
        int matchEmpty = extremeFlag && glob_match(pEmptyDirs, zName+nRoot);
        char *prompt = mprintf("%sRemove %s empty directory \"%s\" "
                               "(a=all/y/N)? ",
                               (matchEmpty || matchIgnore) ?







|
|
|







 







|
>







 







|
>







540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
...
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
...
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
**                     comma separated list of glob patterns.
**    --keep <CSG>     Keep files matching this comma separated
**                     list of glob patterns.
**    -n|--dry-run     If given, display instead of run actions.
**    --temp           Remove only Fossil-generated temporary files.
**    -v|--verbose     Show all files as they are removed.
**    -x|--extreme     Remove all files not part of the current
**                     checkout, except the ones matching --keep.
**                     Files not matching any of --clean/--ignore/-keep,
**                     will be prompted for.
**                     Compatibile with "git clean -x".
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
  int allFileFlag, allDirFlag, dryRunFlag, verboseFlag, extremeFlag;
  int emptyDirsFlag, dirsOnlyFlag;
................................................................................
    );
    if( file_tree_name(g.zRepositoryName, &repo, 0) ){
      db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
    }
    db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
    while( db_step(&q)==SQLITE_ROW ){
      const char *zName = db_column_text(&q, 0);
      if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot)
          && !(extremeFlag && glob_match(pIgnore, zName+nRoot)) ){
        Blob ans;
        char cReply;
        int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
        char *prompt = mprintf("%sRemove %s file \"%s\" (a=all/y/N)? ",
                               matchIgnore ? "WARNING: " : "",
                               matchIgnore ? "\"IGNORED\"" : "unmanaged",
                               zName+nRoot);
................................................................................
        "SELECT %Q || x FROM dscan_temp"
        " WHERE x NOT IN (%s) AND y = 0"
        " ORDER BY 1 DESC",
        g.zLocalRoot, fossil_all_reserved_names(0)
    );
    while( db_step(&q)==SQLITE_ROW ){
      const char *zName = db_column_text(&q, 0);
      if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot)
          && !(extremeFlag && glob_match(pIgnore, zName+nRoot)) ){
        Blob ans;
        char cReply;
        int matchIgnore = extremeFlag && glob_match(pIgnore, zName+nRoot);
        int matchEmpty = extremeFlag && glob_match(pEmptyDirs, zName+nRoot);
        char *prompt = mprintf("%sRemove %s empty directory \"%s\" "
                               "(a=all/y/N)? ",
                               (matchEmpty || matchIgnore) ?