Fossil SCM

rebase

jan.nijtmans 2013-04-03 10:02 UTC trunk merge
Commit 2e545d586577db00f357c9d4cf5875735f21d989
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -0,0 +1,6 @@
1
+*.a
2
+*.lib
3
+*.o
4
+
5
+autoconfig.h
6
+co
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -0,0 +1,6 @@
 
 
 
 
 
 
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -0,0 +1,6 @@
1 *.a
2 *.lib
3 *.o
4
5 autoconfig.h
6 co
--- a/.fossil-settings/keep-glob
+++ b/.fossil-settings/keep-glob
@@ -0,0 +1,2 @@
1
+fossil
2
+fossil.exe
--- a/.fossil-settings/keep-glob
+++ b/.fossil-settings/keep-glob
@@ -0,0 +1,2 @@
 
 
--- a/.fossil-settings/keep-glob
+++ b/.fossil-settings/keep-glob
@@ -0,0 +1,2 @@
1 fossil
2 fossil.exe
+24 -14
--- src/checkin.c
+++ src/checkin.c
@@ -378,57 +378,65 @@
378378
**
379379
** Delete all "extra" files in the source tree. "Extra" files are
380380
** files that are not officially part of the checkout. This operation
381381
** cannot be undone.
382382
**
383
-** You will be prompted before removing each file. If you are
384
-** sure you wish to remove all "extra" files you can specify the
385
-** optional --force flag and no prompts will be issued.
383
+** You will be prompted before removing each file, except for files
384
+** matching the patterns specified with --ignore and --keep. The GLOBPATTERN
385
+** specified by the "ignore-glob" setting is used if the --ignore
386
+** option is omitted, the same with "keep-glob" and --keep. If you are
387
+** sure you wish to remove all "extra" files except the ones specified
388
+** with --keep, you can specify the optional --force flag and no prompts
389
+** will be issued. If any file matches both --keep and --ignore, --keep
390
+** takes precedence.
386391
**
387392
** Files and subdirectories whose names begin with "." are
388
-** normally ignored. They are included if the "--dotfiles" option
393
+** normally kept. They are handled if the "--dotfiles" option
389394
** is used.
390395
**
391
-** The GLOBPATTERN is a comma-separated list of GLOB expressions for
392
-** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
393
-** is used if the --ignore option is omitted.
394
-**
395396
** Options:
396397
** --dotfiles include files beginning with a dot (".")
397398
** --force Remove files without prompting
398
-** --ignore <CSG> ignore files matching patterns from the
399
+** --ignore <CSG> don't prompt for files matching this
399400
** comma separated list of glob patterns.
401
+** --keep <CSG> keep files matching this comma separated
402
+** list of glob patterns.
400403
** --temp Remove only Fossil-generated temporary files
401404
**
402405
** See also: addremove, extra, status
403406
*/
404407
void clean_cmd(void){
405408
int allFlag;
406409
unsigned scanFlags = 0;
407
- const char *zIgnoreFlag;
410
+ const char *zIgnoreFlag, *zKeepFlag;
408411
Blob path, repo;
409412
Stmt q;
410413
int n;
411
- Glob *pIgnore;
414
+ Glob *pIgnore, *pKeep;
412415
int testFlag = 0;
413416
414417
allFlag = find_option("force","f",0)!=0;
415418
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
416419
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
417420
zIgnoreFlag = find_option("ignore",0,1);
421
+ zKeepFlag = find_option("keep",0,1);
418422
testFlag = find_option("test",0,0)!=0;
419423
db_must_be_within_tree();
420424
if( zIgnoreFlag==0 ){
421425
zIgnoreFlag = db_get("ignore-glob", 0);
422426
}
427
+ if( zKeepFlag==0 ){
428
+ zKeepFlag = db_get("keep-glob", 0);
429
+ }
423430
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
424431
filename_collation());
425432
n = strlen(g.zLocalRoot);
426433
blob_init(&path, g.zLocalRoot, n-1);
427434
pIgnore = glob_create(zIgnoreFlag);
428
- vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
429
- glob_free(pIgnore);
435
+ pKeep = glob_create(zKeepFlag);
436
+ vfile_scan(&path, blob_size(&path), scanFlags, pKeep);
437
+ glob_free(pKeep);
430438
db_prepare(&q,
431439
"SELECT %Q || x FROM sfile"
432440
" WHERE x NOT IN (%s)"
433441
" ORDER BY 1",
434442
g.zLocalRoot, fossil_all_reserved_names(0)
@@ -439,11 +447,11 @@
439447
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
440448
while( db_step(&q)==SQLITE_ROW ){
441449
if( testFlag ){
442450
fossil_print("%s\n", db_column_text(&q,0));
443451
continue;
444
- }else if( !allFlag ){
452
+ }else if( !allFlag && !glob_match(pIgnore, db_column_text(&q, 0)+n) ){
445453
Blob ans;
446454
char cReply;
447455
char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
448456
db_column_text(&q, 0));
449457
blob_zero(&ans);
@@ -453,12 +461,14 @@
453461
allFlag = 1;
454462
}else if( cReply!='y' && cReply!='Y' ){
455463
continue;
456464
}
457465
}
466
+ fossil_print("removed unmanaged file \"%s\"\n", db_column_text(&q,0));
458467
file_delete(db_column_text(&q, 0));
459468
}
469
+ glob_free(pIgnore);
460470
db_finalize(&q);
461471
}
462472
463473
/*
464474
** Prompt the user for a check-in or stash comment (given in pPrompt),
465475
--- src/checkin.c
+++ src/checkin.c
@@ -378,57 +378,65 @@
378 **
379 ** Delete all "extra" files in the source tree. "Extra" files are
380 ** files that are not officially part of the checkout. This operation
381 ** cannot be undone.
382 **
383 ** You will be prompted before removing each file. If you are
384 ** sure you wish to remove all "extra" files you can specify the
385 ** optional --force flag and no prompts will be issued.
 
 
 
 
 
386 **
387 ** Files and subdirectories whose names begin with "." are
388 ** normally ignored. They are included if the "--dotfiles" option
389 ** is used.
390 **
391 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
392 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
393 ** is used if the --ignore option is omitted.
394 **
395 ** Options:
396 ** --dotfiles include files beginning with a dot (".")
397 ** --force Remove files without prompting
398 ** --ignore <CSG> ignore files matching patterns from the
399 ** comma separated list of glob patterns.
 
 
400 ** --temp Remove only Fossil-generated temporary files
401 **
402 ** See also: addremove, extra, status
403 */
404 void clean_cmd(void){
405 int allFlag;
406 unsigned scanFlags = 0;
407 const char *zIgnoreFlag;
408 Blob path, repo;
409 Stmt q;
410 int n;
411 Glob *pIgnore;
412 int testFlag = 0;
413
414 allFlag = find_option("force","f",0)!=0;
415 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
416 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
417 zIgnoreFlag = find_option("ignore",0,1);
 
418 testFlag = find_option("test",0,0)!=0;
419 db_must_be_within_tree();
420 if( zIgnoreFlag==0 ){
421 zIgnoreFlag = db_get("ignore-glob", 0);
422 }
 
 
 
423 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
424 filename_collation());
425 n = strlen(g.zLocalRoot);
426 blob_init(&path, g.zLocalRoot, n-1);
427 pIgnore = glob_create(zIgnoreFlag);
428 vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
429 glob_free(pIgnore);
 
430 db_prepare(&q,
431 "SELECT %Q || x FROM sfile"
432 " WHERE x NOT IN (%s)"
433 " ORDER BY 1",
434 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -439,11 +447,11 @@
439 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
440 while( db_step(&q)==SQLITE_ROW ){
441 if( testFlag ){
442 fossil_print("%s\n", db_column_text(&q,0));
443 continue;
444 }else if( !allFlag ){
445 Blob ans;
446 char cReply;
447 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
448 db_column_text(&q, 0));
449 blob_zero(&ans);
@@ -453,12 +461,14 @@
453 allFlag = 1;
454 }else if( cReply!='y' && cReply!='Y' ){
455 continue;
456 }
457 }
 
458 file_delete(db_column_text(&q, 0));
459 }
 
460 db_finalize(&q);
461 }
462
463 /*
464 ** Prompt the user for a check-in or stash comment (given in pPrompt),
465
--- src/checkin.c
+++ src/checkin.c
@@ -378,57 +378,65 @@
378 **
379 ** Delete all "extra" files in the source tree. "Extra" files are
380 ** files that are not officially part of the checkout. This operation
381 ** cannot be undone.
382 **
383 ** You will be prompted before removing each file, except for files
384 ** matching the patterns specified with --ignore and --keep. The GLOBPATTERN
385 ** specified by the "ignore-glob" setting is used if the --ignore
386 ** option is omitted, the same with "keep-glob" and --keep. If you are
387 ** sure you wish to remove all "extra" files except the ones specified
388 ** with --keep, you can specify the optional --force flag and no prompts
389 ** will be issued. If any file matches both --keep and --ignore, --keep
390 ** takes precedence.
391 **
392 ** Files and subdirectories whose names begin with "." are
393 ** normally kept. They are handled if the "--dotfiles" option
394 ** is used.
395 **
 
 
 
 
396 ** Options:
397 ** --dotfiles include files beginning with a dot (".")
398 ** --force Remove files without prompting
399 ** --ignore <CSG> don't prompt for files matching this
400 ** comma separated list of glob patterns.
401 ** --keep <CSG> keep files matching this comma separated
402 ** list of glob patterns.
403 ** --temp Remove only Fossil-generated temporary files
404 **
405 ** See also: addremove, extra, status
406 */
407 void clean_cmd(void){
408 int allFlag;
409 unsigned scanFlags = 0;
410 const char *zIgnoreFlag, *zKeepFlag;
411 Blob path, repo;
412 Stmt q;
413 int n;
414 Glob *pIgnore, *pKeep;
415 int testFlag = 0;
416
417 allFlag = find_option("force","f",0)!=0;
418 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
419 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
420 zIgnoreFlag = find_option("ignore",0,1);
421 zKeepFlag = find_option("keep",0,1);
422 testFlag = find_option("test",0,0)!=0;
423 db_must_be_within_tree();
424 if( zIgnoreFlag==0 ){
425 zIgnoreFlag = db_get("ignore-glob", 0);
426 }
427 if( zKeepFlag==0 ){
428 zKeepFlag = db_get("keep-glob", 0);
429 }
430 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
431 filename_collation());
432 n = strlen(g.zLocalRoot);
433 blob_init(&path, g.zLocalRoot, n-1);
434 pIgnore = glob_create(zIgnoreFlag);
435 pKeep = glob_create(zKeepFlag);
436 vfile_scan(&path, blob_size(&path), scanFlags, pKeep);
437 glob_free(pKeep);
438 db_prepare(&q,
439 "SELECT %Q || x FROM sfile"
440 " WHERE x NOT IN (%s)"
441 " ORDER BY 1",
442 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -439,11 +447,11 @@
447 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
448 while( db_step(&q)==SQLITE_ROW ){
449 if( testFlag ){
450 fossil_print("%s\n", db_column_text(&q,0));
451 continue;
452 }else if( !allFlag && !glob_match(pIgnore, db_column_text(&q, 0)+n) ){
453 Blob ans;
454 char cReply;
455 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
456 db_column_text(&q, 0));
457 blob_zero(&ans);
@@ -453,12 +461,14 @@
461 allFlag = 1;
462 }else if( cReply!='y' && cReply!='Y' ){
463 continue;
464 }
465 }
466 fossil_print("removed unmanaged file \"%s\"\n", db_column_text(&q,0));
467 file_delete(db_column_text(&q, 0));
468 }
469 glob_free(pIgnore);
470 db_finalize(&q);
471 }
472
473 /*
474 ** Prompt the user for a check-in or stash comment (given in pPrompt),
475
--- src/configure.c
+++ src/configure.c
@@ -102,10 +102,11 @@
102102
{ "project-name", CONFIGSET_PROJ },
103103
{ "project-description", CONFIGSET_PROJ },
104104
{ "manifest", CONFIGSET_PROJ },
105105
{ "binary-glob", CONFIGSET_PROJ },
106106
{ "ignore-glob", CONFIGSET_PROJ },
107
+ { "keep-glob", CONFIGSET_PROJ },
107108
{ "crnl-glob", CONFIGSET_PROJ },
108109
{ "encoding-glob", CONFIGSET_PROJ },
109110
{ "empty-dirs", CONFIGSET_PROJ },
110111
{ "allow-symlinks", CONFIGSET_PROJ },
111112
112113
--- src/configure.c
+++ src/configure.c
@@ -102,10 +102,11 @@
102 { "project-name", CONFIGSET_PROJ },
103 { "project-description", CONFIGSET_PROJ },
104 { "manifest", CONFIGSET_PROJ },
105 { "binary-glob", CONFIGSET_PROJ },
106 { "ignore-glob", CONFIGSET_PROJ },
 
107 { "crnl-glob", CONFIGSET_PROJ },
108 { "encoding-glob", CONFIGSET_PROJ },
109 { "empty-dirs", CONFIGSET_PROJ },
110 { "allow-symlinks", CONFIGSET_PROJ },
111
112
--- src/configure.c
+++ src/configure.c
@@ -102,10 +102,11 @@
102 { "project-name", CONFIGSET_PROJ },
103 { "project-description", CONFIGSET_PROJ },
104 { "manifest", CONFIGSET_PROJ },
105 { "binary-glob", CONFIGSET_PROJ },
106 { "ignore-glob", CONFIGSET_PROJ },
107 { "keep-glob", CONFIGSET_PROJ },
108 { "crnl-glob", CONFIGSET_PROJ },
109 { "encoding-glob", CONFIGSET_PROJ },
110 { "empty-dirs", CONFIGSET_PROJ },
111 { "allow-symlinks", CONFIGSET_PROJ },
112
113
+5
--- src/db.c
+++ src/db.c
@@ -2101,10 +2101,11 @@
21012101
{ "gdiff-command", 0, 40, 0, "gdiff" },
21022102
{ "gmerge-command",0, 40, 0, "" },
21032103
{ "http-port", 0, 16, 0, "8080" },
21042104
{ "https-login", 0, 0, 0, "off" },
21052105
{ "ignore-glob", 0, 40, 1, "" },
2106
+ { "keep-glob", 0, 40, 1, "" },
21062107
{ "localauth", 0, 0, 0, "off" },
21072108
{ "main-branch", 0, 40, 0, "trunk" },
21082109
{ "manifest", 0, 0, 1, "off" },
21092110
{ "max-upload", 0, 25, 0, "250000" },
21102111
{ "mtime-changes", 0, 0, 0, "on" },
@@ -2231,10 +2232,14 @@
22312232
** even if the login page request came via HTTP.
22322233
**
22332234
** ignore-glob The VALUE is a comma or newline-separated list of GLOB
22342235
** (versionable) patterns specifying files that the "extra" command will
22352236
** ignore. Example: *.o,*.obj,*.exe
2237
+**
2238
+** keep-glob The VALUE is a comma or newline-separated list of GLOB
2239
+** (versionable) patterns specifying files that the "clean" command will
2240
+** keep. Example: *.log
22362241
**
22372242
** localauth If enabled, require that HTTP connections from
22382243
** 127.0.0.1 be authenticated by password. If
22392244
** false, all HTTP requests from localhost have
22402245
** unrestricted access to the repository.
22412246
--- src/db.c
+++ src/db.c
@@ -2101,10 +2101,11 @@
2101 { "gdiff-command", 0, 40, 0, "gdiff" },
2102 { "gmerge-command",0, 40, 0, "" },
2103 { "http-port", 0, 16, 0, "8080" },
2104 { "https-login", 0, 0, 0, "off" },
2105 { "ignore-glob", 0, 40, 1, "" },
 
2106 { "localauth", 0, 0, 0, "off" },
2107 { "main-branch", 0, 40, 0, "trunk" },
2108 { "manifest", 0, 0, 1, "off" },
2109 { "max-upload", 0, 25, 0, "250000" },
2110 { "mtime-changes", 0, 0, 0, "on" },
@@ -2231,10 +2232,14 @@
2231 ** even if the login page request came via HTTP.
2232 **
2233 ** ignore-glob The VALUE is a comma or newline-separated list of GLOB
2234 ** (versionable) patterns specifying files that the "extra" command will
2235 ** ignore. Example: *.o,*.obj,*.exe
 
 
 
 
2236 **
2237 ** localauth If enabled, require that HTTP connections from
2238 ** 127.0.0.1 be authenticated by password. If
2239 ** false, all HTTP requests from localhost have
2240 ** unrestricted access to the repository.
2241
--- src/db.c
+++ src/db.c
@@ -2101,10 +2101,11 @@
2101 { "gdiff-command", 0, 40, 0, "gdiff" },
2102 { "gmerge-command",0, 40, 0, "" },
2103 { "http-port", 0, 16, 0, "8080" },
2104 { "https-login", 0, 0, 0, "off" },
2105 { "ignore-glob", 0, 40, 1, "" },
2106 { "keep-glob", 0, 40, 1, "" },
2107 { "localauth", 0, 0, 0, "off" },
2108 { "main-branch", 0, 40, 0, "trunk" },
2109 { "manifest", 0, 0, 1, "off" },
2110 { "max-upload", 0, 25, 0, "250000" },
2111 { "mtime-changes", 0, 0, 0, "on" },
@@ -2231,10 +2232,14 @@
2232 ** even if the login page request came via HTTP.
2233 **
2234 ** ignore-glob The VALUE is a comma or newline-separated list of GLOB
2235 ** (versionable) patterns specifying files that the "extra" command will
2236 ** ignore. Example: *.o,*.obj,*.exe
2237 **
2238 ** keep-glob The VALUE is a comma or newline-separated list of GLOB
2239 ** (versionable) patterns specifying files that the "clean" command will
2240 ** keep. Example: *.log
2241 **
2242 ** localauth If enabled, require that HTTP connections from
2243 ** 127.0.0.1 be authenticated by password. If
2244 ** false, all HTTP requests from localhost have
2245 ** unrestricted access to the repository.
2246
--- src/json_config.c
+++ src/json_config.c
@@ -64,10 +64,11 @@
6464
6565
{ "project-name", CONFIGSET_PROJ },
6666
{ "project-description", CONFIGSET_PROJ },
6767
{ "manifest", CONFIGSET_PROJ },
6868
{ "ignore-glob", CONFIGSET_PROJ },
69
+{ "keep-glob", CONFIGSET_PROJ },
6970
{ "crnl-glob", CONFIGSET_PROJ },
7071
{ "empty-dirs", CONFIGSET_PROJ },
7172
{ "allow-symlinks", CONFIGSET_PROJ },
7273
7374
{ "ticket-table", CONFIGSET_TKT },
7475
--- src/json_config.c
+++ src/json_config.c
@@ -64,10 +64,11 @@
64
65 { "project-name", CONFIGSET_PROJ },
66 { "project-description", CONFIGSET_PROJ },
67 { "manifest", CONFIGSET_PROJ },
68 { "ignore-glob", CONFIGSET_PROJ },
 
69 { "crnl-glob", CONFIGSET_PROJ },
70 { "empty-dirs", CONFIGSET_PROJ },
71 { "allow-symlinks", CONFIGSET_PROJ },
72
73 { "ticket-table", CONFIGSET_TKT },
74
--- src/json_config.c
+++ src/json_config.c
@@ -64,10 +64,11 @@
64
65 { "project-name", CONFIGSET_PROJ },
66 { "project-description", CONFIGSET_PROJ },
67 { "manifest", CONFIGSET_PROJ },
68 { "ignore-glob", CONFIGSET_PROJ },
69 { "keep-glob", CONFIGSET_PROJ },
70 { "crnl-glob", CONFIGSET_PROJ },
71 { "empty-dirs", CONFIGSET_PROJ },
72 { "allow-symlinks", CONFIGSET_PROJ },
73
74 { "ticket-table", CONFIGSET_TKT },
75

Keyboard Shortcuts

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