Fossil SCM

rebase

jan.nijtmans 2013-05-27 09:56 UTC trunk merge
Commit 7f0507c04da883bb64b74d7dd3f2630cda91fdcc
2 files changed +13 -6 +13 -6
+13 -6
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236236
int verboseFlag;
237237
int showAge;
238238
char *zOrderBy = "pathname";
239239
240240
verboseFlag = find_option("verbose","v", 0)!=0;
241
- if(!verboseFlag){
241
+ if( !verboseFlag ){
242242
verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243243
}
244244
showAge = find_option("age",0,0)!=0;
245245
db_must_be_within_tree();
246246
vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381381
** COMMAND: clean
382382
** Usage: %fossil clean ?OPTIONS?
383383
**
384384
** Delete all "extra" files in the source tree. "Extra" files are
385385
** files that are not officially part of the checkout. This operation
386
-** cannot be undone.
386
+** cannot be undone. Normally, only files unknown to fossil are
387
+** removed, but if the -x option is specified, ignored files are
388
+** removed as well.
387389
**
388390
** You will be prompted before removing each eligible file unless the
389391
** --force flag is in use or it matches the --clean option. The
390392
** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391393
** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
410412
** --keep <CSG> keep files matching this comma separated
411413
** list of glob patterns.
412414
** -n|--dry-run If given, display instead of run actions
413415
** --temp Remove only Fossil-generated temporary files
414416
** -v|--verbose Show all files as they are removed
417
+** -x Remove everything unkown to fossil,
418
+** including files matching --ignore.
419
+** Compatibile with "git clean -x".
415420
**
416421
** See also: addremove, extra, status
417422
*/
418423
void clean_cmd(void){
419
- int allFlag, dryRunFlag, verboseFlag;
424
+ int allFlag, dryRunFlag, verboseFlag, xFlag;
420425
unsigned scanFlags = 0;
421426
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422427
Blob path, repo;
423428
Stmt q;
424429
int n;
425430
Glob *pIgnore, *pKeep, *pClean;
426431
427432
dryRunFlag = find_option("dry-run","n",0)!=0;
433
+ xFlag = find_option("x","x",0)!=0;
428434
if( !dryRunFlag ){
429435
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430436
}
431437
allFlag = find_option("force","f",0)!=0 || dryRunFlag;
432438
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
452458
n = strlen(g.zLocalRoot);
453459
blob_init(&path, g.zLocalRoot, n-1);
454460
pIgnore = glob_create(zIgnoreFlag);
455461
pKeep = glob_create(zKeepFlag);
456462
pClean = glob_create(zCleanFlag);
457
- vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
463
+ vfile_scan2(&path, blob_size(&path), scanFlags, xFlag?0:pIgnore, pKeep);
458464
glob_free(pKeep);
459
- glob_free(pIgnore);
460465
db_prepare(&q,
461466
"SELECT %Q || x FROM sfile"
462467
" WHERE x NOT IN (%s)"
463468
" ORDER BY 1",
464469
g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
467472
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468473
}
469474
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
470475
while( db_step(&q)==SQLITE_ROW ){
471476
const char *zName = db_column_text(&q, 0);
472
- if( !allFlag && !glob_match(pClean, zName+n) ){
477
+ if( !allFlag && !glob_match(pClean, zName+n)
478
+ && (!xFlag || !glob_match(pIgnore, zName+n))){
473479
Blob ans;
474480
char cReply;
475481
char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
476482
zName+n);
477483
blob_zero(&ans);
@@ -488,10 +494,11 @@
488494
}
489495
if( !dryRunFlag ){
490496
file_delete(zName);
491497
}
492498
}
499
+ glob_free(pIgnore);
493500
glob_free(pClean);
494501
db_finalize(&q);
495502
}
496503
497504
/*
498505
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236 int verboseFlag;
237 int showAge;
238 char *zOrderBy = "pathname";
239
240 verboseFlag = find_option("verbose","v", 0)!=0;
241 if(!verboseFlag){
242 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243 }
244 showAge = find_option("age",0,0)!=0;
245 db_must_be_within_tree();
246 vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381 ** COMMAND: clean
382 ** Usage: %fossil clean ?OPTIONS?
383 **
384 ** Delete all "extra" files in the source tree. "Extra" files are
385 ** files that are not officially part of the checkout. This operation
386 ** cannot be undone.
 
 
387 **
388 ** You will be prompted before removing each eligible file unless the
389 ** --force flag is in use or it matches the --clean option. The
390 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
410 ** --keep <CSG> keep files matching this comma separated
411 ** list of glob patterns.
412 ** -n|--dry-run If given, display instead of run actions
413 ** --temp Remove only Fossil-generated temporary files
414 ** -v|--verbose Show all files as they are removed
 
 
 
415 **
416 ** See also: addremove, extra, status
417 */
418 void clean_cmd(void){
419 int allFlag, dryRunFlag, verboseFlag;
420 unsigned scanFlags = 0;
421 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422 Blob path, repo;
423 Stmt q;
424 int n;
425 Glob *pIgnore, *pKeep, *pClean;
426
427 dryRunFlag = find_option("dry-run","n",0)!=0;
 
428 if( !dryRunFlag ){
429 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430 }
431 allFlag = find_option("force","f",0)!=0 || dryRunFlag;
432 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
452 n = strlen(g.zLocalRoot);
453 blob_init(&path, g.zLocalRoot, n-1);
454 pIgnore = glob_create(zIgnoreFlag);
455 pKeep = glob_create(zKeepFlag);
456 pClean = glob_create(zCleanFlag);
457 vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
458 glob_free(pKeep);
459 glob_free(pIgnore);
460 db_prepare(&q,
461 "SELECT %Q || x FROM sfile"
462 " WHERE x NOT IN (%s)"
463 " ORDER BY 1",
464 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
467 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468 }
469 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
470 while( db_step(&q)==SQLITE_ROW ){
471 const char *zName = db_column_text(&q, 0);
472 if( !allFlag && !glob_match(pClean, zName+n) ){
 
473 Blob ans;
474 char cReply;
475 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
476 zName+n);
477 blob_zero(&ans);
@@ -488,10 +494,11 @@
488 }
489 if( !dryRunFlag ){
490 file_delete(zName);
491 }
492 }
 
493 glob_free(pClean);
494 db_finalize(&q);
495 }
496
497 /*
498
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236 int verboseFlag;
237 int showAge;
238 char *zOrderBy = "pathname";
239
240 verboseFlag = find_option("verbose","v", 0)!=0;
241 if( !verboseFlag ){
242 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243 }
244 showAge = find_option("age",0,0)!=0;
245 db_must_be_within_tree();
246 vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381 ** COMMAND: clean
382 ** Usage: %fossil clean ?OPTIONS?
383 **
384 ** Delete all "extra" files in the source tree. "Extra" files are
385 ** files that are not officially part of the checkout. This operation
386 ** cannot be undone. Normally, only files unknown to fossil are
387 ** removed, but if the -x option is specified, ignored files are
388 ** removed as well.
389 **
390 ** You will be prompted before removing each eligible file unless the
391 ** --force flag is in use or it matches the --clean option. The
392 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
393 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
412 ** --keep <CSG> keep files matching this comma separated
413 ** list of glob patterns.
414 ** -n|--dry-run If given, display instead of run actions
415 ** --temp Remove only Fossil-generated temporary files
416 ** -v|--verbose Show all files as they are removed
417 ** -x Remove everything unkown to fossil,
418 ** including files matching --ignore.
419 ** Compatibile with "git clean -x".
420 **
421 ** See also: addremove, extra, status
422 */
423 void clean_cmd(void){
424 int allFlag, dryRunFlag, verboseFlag, xFlag;
425 unsigned scanFlags = 0;
426 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
427 Blob path, repo;
428 Stmt q;
429 int n;
430 Glob *pIgnore, *pKeep, *pClean;
431
432 dryRunFlag = find_option("dry-run","n",0)!=0;
433 xFlag = find_option("x","x",0)!=0;
434 if( !dryRunFlag ){
435 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
436 }
437 allFlag = find_option("force","f",0)!=0 || dryRunFlag;
438 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
458 n = strlen(g.zLocalRoot);
459 blob_init(&path, g.zLocalRoot, n-1);
460 pIgnore = glob_create(zIgnoreFlag);
461 pKeep = glob_create(zKeepFlag);
462 pClean = glob_create(zCleanFlag);
463 vfile_scan2(&path, blob_size(&path), scanFlags, xFlag?0:pIgnore, pKeep);
464 glob_free(pKeep);
 
465 db_prepare(&q,
466 "SELECT %Q || x FROM sfile"
467 " WHERE x NOT IN (%s)"
468 " ORDER BY 1",
469 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
472 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
473 }
474 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
475 while( db_step(&q)==SQLITE_ROW ){
476 const char *zName = db_column_text(&q, 0);
477 if( !allFlag && !glob_match(pClean, zName+n)
478 && (!xFlag || !glob_match(pIgnore, zName+n))){
479 Blob ans;
480 char cReply;
481 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
482 zName+n);
483 blob_zero(&ans);
@@ -488,10 +494,11 @@
494 }
495 if( !dryRunFlag ){
496 file_delete(zName);
497 }
498 }
499 glob_free(pIgnore);
500 glob_free(pClean);
501 db_finalize(&q);
502 }
503
504 /*
505
+13 -6
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236236
int verboseFlag;
237237
int showAge;
238238
char *zOrderBy = "pathname";
239239
240240
verboseFlag = find_option("verbose","v", 0)!=0;
241
- if(!verboseFlag){
241
+ if( !verboseFlag ){
242242
verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243243
}
244244
showAge = find_option("age",0,0)!=0;
245245
db_must_be_within_tree();
246246
vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381381
** COMMAND: clean
382382
** Usage: %fossil clean ?OPTIONS?
383383
**
384384
** Delete all "extra" files in the source tree. "Extra" files are
385385
** files that are not officially part of the checkout. This operation
386
-** cannot be undone.
386
+** cannot be undone. Normally, only files unknown to fossil are
387
+** removed, but if the -x option is specified, ignored files are
388
+** removed as well.
387389
**
388390
** You will be prompted before removing each eligible file unless the
389391
** --force flag is in use or it matches the --clean option. The
390392
** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391393
** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
410412
** --keep <CSG> keep files matching this comma separated
411413
** list of glob patterns.
412414
** -n|--dry-run If given, display instead of run actions
413415
** --temp Remove only Fossil-generated temporary files
414416
** -v|--verbose Show all files as they are removed
417
+** -x Remove everything unkown to fossil,
418
+** including files matching --ignore.
419
+** Compatibile with "git clean -x".
415420
**
416421
** See also: addremove, extra, status
417422
*/
418423
void clean_cmd(void){
419
- int allFlag, dryRunFlag, verboseFlag;
424
+ int allFlag, dryRunFlag, verboseFlag, xFlag;
420425
unsigned scanFlags = 0;
421426
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422427
Blob path, repo;
423428
Stmt q;
424429
int n;
425430
Glob *pIgnore, *pKeep, *pClean;
426431
427432
dryRunFlag = find_option("dry-run","n",0)!=0;
433
+ xFlag = find_option("x","x",0)!=0;
428434
if( !dryRunFlag ){
429435
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430436
}
431437
allFlag = find_option("force","f",0)!=0 || dryRunFlag;
432438
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
452458
n = strlen(g.zLocalRoot);
453459
blob_init(&path, g.zLocalRoot, n-1);
454460
pIgnore = glob_create(zIgnoreFlag);
455461
pKeep = glob_create(zKeepFlag);
456462
pClean = glob_create(zCleanFlag);
457
- vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
463
+ vfile_scan2(&path, blob_size(&path), scanFlags, xFlag?0:pIgnore, pKeep);
458464
glob_free(pKeep);
459
- glob_free(pIgnore);
460465
db_prepare(&q,
461466
"SELECT %Q || x FROM sfile"
462467
" WHERE x NOT IN (%s)"
463468
" ORDER BY 1",
464469
g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
467472
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468473
}
469474
db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
470475
while( db_step(&q)==SQLITE_ROW ){
471476
const char *zName = db_column_text(&q, 0);
472
- if( !allFlag && !glob_match(pClean, zName+n) ){
477
+ if( !allFlag && !glob_match(pClean, zName+n)
478
+ && (!xFlag || !glob_match(pIgnore, zName+n))){
473479
Blob ans;
474480
char cReply;
475481
char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
476482
zName+n);
477483
blob_zero(&ans);
@@ -488,10 +494,11 @@
488494
}
489495
if( !dryRunFlag ){
490496
file_delete(zName);
491497
}
492498
}
499
+ glob_free(pIgnore);
493500
glob_free(pClean);
494501
db_finalize(&q);
495502
}
496503
497504
/*
498505
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236 int verboseFlag;
237 int showAge;
238 char *zOrderBy = "pathname";
239
240 verboseFlag = find_option("verbose","v", 0)!=0;
241 if(!verboseFlag){
242 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243 }
244 showAge = find_option("age",0,0)!=0;
245 db_must_be_within_tree();
246 vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381 ** COMMAND: clean
382 ** Usage: %fossil clean ?OPTIONS?
383 **
384 ** Delete all "extra" files in the source tree. "Extra" files are
385 ** files that are not officially part of the checkout. This operation
386 ** cannot be undone.
 
 
387 **
388 ** You will be prompted before removing each eligible file unless the
389 ** --force flag is in use or it matches the --clean option. The
390 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
391 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
410 ** --keep <CSG> keep files matching this comma separated
411 ** list of glob patterns.
412 ** -n|--dry-run If given, display instead of run actions
413 ** --temp Remove only Fossil-generated temporary files
414 ** -v|--verbose Show all files as they are removed
 
 
 
415 **
416 ** See also: addremove, extra, status
417 */
418 void clean_cmd(void){
419 int allFlag, dryRunFlag, verboseFlag;
420 unsigned scanFlags = 0;
421 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
422 Blob path, repo;
423 Stmt q;
424 int n;
425 Glob *pIgnore, *pKeep, *pClean;
426
427 dryRunFlag = find_option("dry-run","n",0)!=0;
 
428 if( !dryRunFlag ){
429 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
430 }
431 allFlag = find_option("force","f",0)!=0 || dryRunFlag;
432 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
452 n = strlen(g.zLocalRoot);
453 blob_init(&path, g.zLocalRoot, n-1);
454 pIgnore = glob_create(zIgnoreFlag);
455 pKeep = glob_create(zKeepFlag);
456 pClean = glob_create(zCleanFlag);
457 vfile_scan2(&path, blob_size(&path), scanFlags, pIgnore, pKeep);
458 glob_free(pKeep);
459 glob_free(pIgnore);
460 db_prepare(&q,
461 "SELECT %Q || x FROM sfile"
462 " WHERE x NOT IN (%s)"
463 " ORDER BY 1",
464 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
467 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
468 }
469 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
470 while( db_step(&q)==SQLITE_ROW ){
471 const char *zName = db_column_text(&q, 0);
472 if( !allFlag && !glob_match(pClean, zName+n) ){
 
473 Blob ans;
474 char cReply;
475 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
476 zName+n);
477 blob_zero(&ans);
@@ -488,10 +494,11 @@
488 }
489 if( !dryRunFlag ){
490 file_delete(zName);
491 }
492 }
 
493 glob_free(pClean);
494 db_finalize(&q);
495 }
496
497 /*
498
--- src/checkin.c
+++ src/checkin.c
@@ -236,11 +236,11 @@
236 int verboseFlag;
237 int showAge;
238 char *zOrderBy = "pathname";
239
240 verboseFlag = find_option("verbose","v", 0)!=0;
241 if( !verboseFlag ){
242 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
243 }
244 showAge = find_option("age",0,0)!=0;
245 db_must_be_within_tree();
246 vid = db_lget_int("checkout", 0);
@@ -381,11 +381,13 @@
381 ** COMMAND: clean
382 ** Usage: %fossil clean ?OPTIONS?
383 **
384 ** Delete all "extra" files in the source tree. "Extra" files are
385 ** files that are not officially part of the checkout. This operation
386 ** cannot be undone. Normally, only files unknown to fossil are
387 ** removed, but if the -x option is specified, ignored files are
388 ** removed as well.
389 **
390 ** You will be prompted before removing each eligible file unless the
391 ** --force flag is in use or it matches the --clean option. The
392 ** GLOBPATTERN specified by the "ignore-glob" setting is used if the
393 ** --ignore option is omitted, the same with "clean-glob" and --clean
@@ -410,23 +412,27 @@
412 ** --keep <CSG> keep files matching this comma separated
413 ** list of glob patterns.
414 ** -n|--dry-run If given, display instead of run actions
415 ** --temp Remove only Fossil-generated temporary files
416 ** -v|--verbose Show all files as they are removed
417 ** -x Remove everything unkown to fossil,
418 ** including files matching --ignore.
419 ** Compatibile with "git clean -x".
420 **
421 ** See also: addremove, extra, status
422 */
423 void clean_cmd(void){
424 int allFlag, dryRunFlag, verboseFlag, xFlag;
425 unsigned scanFlags = 0;
426 const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
427 Blob path, repo;
428 Stmt q;
429 int n;
430 Glob *pIgnore, *pKeep, *pClean;
431
432 dryRunFlag = find_option("dry-run","n",0)!=0;
433 xFlag = find_option("x","x",0)!=0;
434 if( !dryRunFlag ){
435 dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
436 }
437 allFlag = find_option("force","f",0)!=0 || dryRunFlag;
438 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
@@ -452,13 +458,12 @@
458 n = strlen(g.zLocalRoot);
459 blob_init(&path, g.zLocalRoot, n-1);
460 pIgnore = glob_create(zIgnoreFlag);
461 pKeep = glob_create(zKeepFlag);
462 pClean = glob_create(zCleanFlag);
463 vfile_scan2(&path, blob_size(&path), scanFlags, xFlag?0:pIgnore, pKeep);
464 glob_free(pKeep);
 
465 db_prepare(&q,
466 "SELECT %Q || x FROM sfile"
467 " WHERE x NOT IN (%s)"
468 " ORDER BY 1",
469 g.zLocalRoot, fossil_all_reserved_names(0)
@@ -467,11 +472,12 @@
472 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
473 }
474 db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)");
475 while( db_step(&q)==SQLITE_ROW ){
476 const char *zName = db_column_text(&q, 0);
477 if( !allFlag && !glob_match(pClean, zName+n)
478 && (!xFlag || !glob_match(pIgnore, zName+n))){
479 Blob ans;
480 char cReply;
481 char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
482 zName+n);
483 blob_zero(&ans);
@@ -488,10 +494,11 @@
494 }
495 if( !dryRunFlag ){
496 file_delete(zName);
497 }
498 }
499 glob_free(pIgnore);
500 glob_free(pClean);
501 db_finalize(&q);
502 }
503
504 /*
505

Keyboard Shortcuts

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