Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Remove excess verbage from the output of "fossil clean" unless the --verbose or -v command-line option is used. Issue an error if an unrecognized command-line argument is seen, to prevent mistakes like using --dryrun instead of --dry-run. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
273ec22f25699c150fbdde995780b504 |
| User & Date: | drh 2013-05-17 12:04:28.110 |
Context
|
2013-05-20
| ||
| 10:58 | doc fix check-in: 122b631c31 user: jan.nijtmans tags: trunk | |
|
2013-05-17
| ||
| 12:04 | Remove excess verbage from the output of "fossil clean" unless the --verbose or -v command-line option is used. Issue an error if an unrecognized command-line argument is seen, to prevent mistakes like using --dryrun instead of --dry-run. check-in: 273ec22f25 user: drh tags: trunk | |
|
2013-05-15
| ||
| 18:49 | Load the latest SQLite library from upstream, for the purpose of testing the 3.7.17 beta of SQLite in a real-world application. check-in: 997ebf7ff4 user: drh tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
** comma separated list of glob patterns.
** --ignore <CSG> ignore files matching patterns from the
** 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
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
int allFlag;
unsigned scanFlags = 0;
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
Blob path, repo;
Stmt q;
int n;
Glob *pIgnore, *pKeep, *pClean;
int dryRunFlag = 0;
allFlag = find_option("force","f",0)!=0;
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
zIgnoreFlag = find_option("ignore",0,1);
dryRunFlag = find_option("dry-run","n",0)!=0;
if( !dryRunFlag ){
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
}
zKeepFlag = find_option("keep",0,1);
zCleanFlag = find_option("clean",0,1);
capture_case_sensitive_option();
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( zKeepFlag==0 ){
zKeepFlag = db_get("keep-glob", 0);
}
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
filename_collation());
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
pIgnore = glob_create(zIgnoreFlag);
pKeep = glob_create(zKeepFlag);
pClean = glob_create(zCleanFlag);
| > > > > | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
** comma separated list of glob patterns.
** --ignore <CSG> ignore files matching patterns from the
** 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
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
int allFlag;
unsigned scanFlags = 0;
const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag;
Blob path, repo;
Stmt q;
int n;
Glob *pIgnore, *pKeep, *pClean;
int dryRunFlag = 0;
int verboseFlag;
allFlag = find_option("force","f",0)!=0;
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
zIgnoreFlag = find_option("ignore",0,1);
verboseFlag = find_option("verbose","v",0)!=0;
dryRunFlag = find_option("dry-run","n",0)!=0;
if( !dryRunFlag ){
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
}
zKeepFlag = find_option("keep",0,1);
zCleanFlag = find_option("clean",0,1);
capture_case_sensitive_option();
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( zKeepFlag==0 ){
zKeepFlag = db_get("keep-glob", 0);
}
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
verify_all_options();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
filename_collation());
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
pIgnore = glob_create(zIgnoreFlag);
pKeep = glob_create(zKeepFlag);
pClean = glob_create(zCleanFlag);
|
| ︙ | ︙ | |||
460 461 462 463 464 465 466 |
);
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);
| | > | > | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
);
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( !allFlag && !dryRunFlag && !glob_match(pClean, zName+n) ){
Blob ans;
char cReply;
char *prompt = mprintf("remove unmanaged file \"%s\" (a=all/y/N)? ",
zName+n);
blob_zero(&ans);
prompt_user(prompt, &ans);
cReply = blob_str(&ans)[0];
if( cReply=='a' || cReply=='A' ){
allFlag = 1;
}else if( cReply!='y' && cReply!='Y' ){
continue;
}
}
if( dryRunFlag || verboseFlag ){
fossil_print("removed unmanaged file: %s\n", zName+n);
}
if( !dryRunFlag ){
file_delete(zName);
}
}
glob_free(pClean);
db_finalize(&q);
}
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
862 863 864 865 866 867 868 869 870 871 872 873 874 875 |
/*
** Force the standard output cursor to move to the beginning
** of a line, if it is not there already.
*/
void fossil_force_newline(void){
if( g.cgiOutput==0 && stdoutAtBOL==0 ) fossil_puts("\n", 0);
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
*/
void fossil_print(const char *zFormat, ...){
| > > > > > > > > | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 |
/*
** Force the standard output cursor to move to the beginning
** of a line, if it is not there already.
*/
void fossil_force_newline(void){
if( g.cgiOutput==0 && stdoutAtBOL==0 ) fossil_puts("\n", 0);
}
/*
** Indicate that the cursor has moved to the start of a line by means
** other than writing to standard output.
*/
void fossil_new_line_started(void){
stdoutAtBOL = 1;
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
*/
void fossil_print(const char *zFormat, ...){
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
char zLine[1000];
blob_zero(pIn);
fossil_force_newline();
fossil_print("%s", zPrompt);
fflush(stdout);
z = fgets(zLine, sizeof(zLine), stdin);
if( z ){
strip_string(pIn, z);
}
}
/*
** COMMAND: user*
| > > | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
char zLine[1000];
blob_zero(pIn);
fossil_force_newline();
fossil_print("%s", zPrompt);
fflush(stdout);
z = fgets(zLine, sizeof(zLine), stdin);
if( z ){
int n = (int)strlen(z);
if( n>0 && z[n-1]=='\n' ) fossil_new_line_started();
strip_string(pIn, z);
}
}
/*
** COMMAND: user*
|
| ︙ | ︙ |