Fossil SCM

Add the undocumented --test option to "fossil clean", so that we can easily see what is being removed without actually removing it. This found a bug in the case-sensitivity logic, which was also fixed. Ticket [03fec0ab6021c776a4b3]

drh 2012-11-02 22:32 trunk
Commit d66057762f7e570bc4266b98a78ed9150e97dbda
1 file changed +6 -1
+6 -1
--- src/checkin.c
+++ src/checkin.c
@@ -412,15 +412,17 @@
412412
const char *zIgnoreFlag;
413413
Blob path, repo;
414414
Stmt q;
415415
int n;
416416
Glob *pIgnore;
417
+ int testFlag = 0;
417418
418419
allFlag = find_option("force","f",0)!=0;
419420
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
420421
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
421422
zIgnoreFlag = find_option("ignore",0,1);
423
+ testFlag = find_option("test",0,0)!=0;
422424
db_must_be_within_tree();
423425
if( zIgnoreFlag==0 ){
424426
zIgnoreFlag = db_get("ignore-glob", 0);
425427
}
426428
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
@@ -437,12 +439,15 @@
437439
g.zLocalRoot, fossil_all_reserved_names()
438440
);
439441
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
440442
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
441443
}
444
+ db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
442445
while( db_step(&q)==SQLITE_ROW ){
443
- if( allFlag ){
446
+ if( testFlag ){
447
+ fossil_print("%s\n", db_column_text(&q,0));
448
+ }else if( allFlag ){
444449
file_delete(db_column_text(&q, 0));
445450
}else{
446451
Blob ans;
447452
char cReply;
448453
char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ",
449454
--- src/checkin.c
+++ src/checkin.c
@@ -412,15 +412,17 @@
412 const char *zIgnoreFlag;
413 Blob path, repo;
414 Stmt q;
415 int n;
416 Glob *pIgnore;
 
417
418 allFlag = find_option("force","f",0)!=0;
419 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
420 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
421 zIgnoreFlag = find_option("ignore",0,1);
 
422 db_must_be_within_tree();
423 if( zIgnoreFlag==0 ){
424 zIgnoreFlag = db_get("ignore-glob", 0);
425 }
426 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
@@ -437,12 +439,15 @@
437 g.zLocalRoot, fossil_all_reserved_names()
438 );
439 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
440 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
441 }
 
442 while( db_step(&q)==SQLITE_ROW ){
443 if( allFlag ){
 
 
444 file_delete(db_column_text(&q, 0));
445 }else{
446 Blob ans;
447 char cReply;
448 char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ",
449
--- src/checkin.c
+++ src/checkin.c
@@ -412,15 +412,17 @@
412 const char *zIgnoreFlag;
413 Blob path, repo;
414 Stmt q;
415 int n;
416 Glob *pIgnore;
417 int testFlag = 0;
418
419 allFlag = find_option("force","f",0)!=0;
420 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
421 if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
422 zIgnoreFlag = find_option("ignore",0,1);
423 testFlag = find_option("test",0,0)!=0;
424 db_must_be_within_tree();
425 if( zIgnoreFlag==0 ){
426 zIgnoreFlag = db_get("ignore-glob", 0);
427 }
428 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
@@ -437,12 +439,15 @@
439 g.zLocalRoot, fossil_all_reserved_names()
440 );
441 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
442 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
443 }
444 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
445 while( db_step(&q)==SQLITE_ROW ){
446 if( testFlag ){
447 fossil_print("%s\n", db_column_text(&q,0));
448 }else if( allFlag ){
449 file_delete(db_column_text(&q, 0));
450 }else{
451 Blob ans;
452 char cReply;
453 char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ",
454

Keyboard Shortcuts

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