Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the --temp option to the "fossil extra" and "fossil clean" commands. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
3206b6485a67d0284b078af83f71ef78 |
| User & Date: | drh 2012-10-13 14:19:03.969 |
Context
|
2012-10-13
| ||
| 17:31 | Omit the "private" tag from private check-ins. This opens up the possibility of publishing check-ins that were originally private. Fix the "deconstruct" command so that it omits private artifacts unless the --private option is used. ... (check-in: 6545e6cf74 user: drh tags: trunk) | |
| 14:19 | Add the --temp option to the "fossil extra" and "fossil clean" commands. ... (check-in: 3206b6485a user: drh tags: trunk) | |
|
2012-10-12
| ||
| 13:21 | Show the complete text of added and removed files on the "vdiff" webpage. ... (check-in: c32a97e1b2 user: drh tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
214 215 216 217 218 219 220 221 222 |
void add_cmd(void){
int i; /* Loop counter */
int vid; /* Currently checked out version */
int nRoot; /* Full path characters in g.zLocalRoot */
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
Glob *pIgnore; /* Ignore everything matching this glob pattern */
int caseSensitive; /* True if filenames are case sensitive */
zIgnoreFlag = find_option("ignore",0,1);
| > | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
void add_cmd(void){
int i; /* Loop counter */
int vid; /* Currently checked out version */
int nRoot; /* Full path characters in g.zLocalRoot */
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
Glob *pIgnore; /* Ignore everything matching this glob pattern */
int caseSensitive; /* True if filenames are case sensitive */
unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
zIgnoreFlag = find_option("ignore",0,1);
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
capture_case_sensitive_option();
db_must_be_within_tree();
caseSensitive = filenames_are_case_sensitive();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
vid = db_lget_int("checkout",0);
|
| ︙ | ︙ | |||
248 249 250 251 252 253 254 |
int isDir;
Blob fullName;
file_canonical_name(g.argv[i], &fullName, 0);
zName = blob_str(&fullName);
isDir = file_wd_isdir(zName);
if( isDir==1 ){
| | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
int isDir;
Blob fullName;
file_canonical_name(g.argv[i], &fullName, 0);
zName = blob_str(&fullName);
isDir = file_wd_isdir(zName);
if( isDir==1 ){
vfile_scan(&fullName, nRoot-1, scanFlags, pIgnore);
}else if( isDir==0 ){
fossil_warning("not found: %s", zName);
}else if( file_access(zName, R_OK) ){
fossil_fatal("cannot open %s", zName);
}else{
char *zTreeName = &zName[nRoot];
db_multi_exec(
|
| ︙ | ︙ | |||
431 432 433 434 435 436 437 |
** --test If given, display instead of run actions
**
** See also: add, rm
*/
void addremove_cmd(void){
Blob path;
const char *zIgnoreFlag = find_option("ignore",0,1);
| | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
** --test If given, display instead of run actions
**
** See also: add, rm
*/
void addremove_cmd(void){
Blob path;
const char *zIgnoreFlag = find_option("ignore",0,1);
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
int isTest = find_option("test",0,0)!=0;
int caseSensitive;
int n;
Stmt q;
int vid;
int nAdd = 0;
int nDelete = 0;
|
| ︙ | ︙ | |||
464 465 466 467 468 469 470 |
** the files in the sfile temp table to the set of managed files.
*/
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
/* now we read the complete file structure into a temp table */
pIgnore = glob_create(zIgnoreFlag);
| | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
** the files in the sfile temp table to the set of managed files.
*/
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
/* now we read the complete file structure into a temp table */
pIgnore = glob_create(zIgnoreFlag);
vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
glob_free(pIgnore);
nAdd = add_files_in_sfile(vid, caseSensitive);
/* step 2: search for missing files */
db_prepare(&q,
"SELECT pathname, %Q || pathname, deleted FROM vfile"
" WHERE NOT deleted"
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
*/
void extra_cmd(void){
Blob path;
Blob repo;
Stmt q;
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
| | > | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
*/
void extra_cmd(void){
Blob path;
Blob repo;
Stmt q;
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0;
int cwdRelative = 0;
Glob *pIgnore;
Blob rewrittenPathname;
const char *zPathname, *zDisplayName;
if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP;
db_must_be_within_tree();
cwdRelative = determine_cwd_relative_option();
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);
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
pIgnore = glob_create(zIgnoreFlag);
vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
glob_free(pIgnore);
db_prepare(&q,
"SELECT x FROM sfile"
" WHERE x NOT IN (%s)"
" ORDER BY 1",
fossil_all_reserved_names()
);
|
| ︙ | ︙ | |||
393 394 395 396 397 398 399 400 401 402 403 404 |
** is used if the --ignore option is omitted.
**
** Options:
** --dotfiles include files beginning with a dot (".")
** --force Remove files without prompting
** --ignore <CSG> ignore files matching patterns from the
** comma separated list of glob patterns.
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
int allFlag;
| > | | > | | 394 395 396 397 398 399 400 401 402 403 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 |
** is used if the --ignore option is omitted.
**
** Options:
** --dotfiles include files beginning with a dot (".")
** --force Remove files without prompting
** --ignore <CSG> ignore files matching patterns from the
** comma separated list of glob patterns.
** --temp Remove only Fossil-generated temporary files
**
** See also: addremove, extra, status
*/
void clean_cmd(void){
int allFlag;
unsigned scanFlags = 0;
const char *zIgnoreFlag;
Blob path, repo;
Stmt q;
int n;
Glob *pIgnore;
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);
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
pIgnore = glob_create(zIgnoreFlag);
vfile_scan(&path, blob_size(&path), scanFlags, pIgnore);
glob_free(pIgnore);
db_prepare(&q,
"SELECT %Q || x FROM sfile"
" WHERE x NOT IN (%s)"
" ORDER BY 1",
g.zLocalRoot, fossil_all_reserved_names()
);
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
zFile = mprintf("%s/.fos", zPath);
fileFound = file_size(zFile)>=1024;
fossil_free(zFile);
}
return fileFound;
}
/*
** Load into table SFILE the name of every ordinary file in
** the directory pPath. Omit the first nPrefix characters of
** of pPath when inserting into the SFILE table.
**
** Subdirectories are scanned recursively.
** Omit files named in VFILE.
**
** Files whose names begin with "." are omitted unless allFlag is true.
**
** Any files or directories that match the glob pattern pIgnore are
** excluded from the scan. Name matching occurs after the first
** nPrefix characters are elided from the filename.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 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 |
zFile = mprintf("%s/.fos", zPath);
fileFound = file_size(zFile)>=1024;
fossil_free(zFile);
}
return fileFound;
}
/*
** Return TRUE if zFile is a temporary file. Return FALSE if not.
*/
static int is_temporary_file(const char *zName){
static const char *azTemp[] = {
"baseline",
"merge",
"original",
"output",
};
int i, j, n;
if( strglob("ci-comment-????????????.txt", zName) ) return 1;
for(; zName[0]!=0; zName++){
if( zName[0]=='/' && strglob("/ci-comment-????????????.txt", zName) ){
return 1;
}
if( zName[0]!='-' ) continue;
for(i=0; i<sizeof(azTemp)/sizeof(azTemp[0]); i++){
n = (int)strlen(azTemp[i]);
if( memcmp(azTemp[i], zName+1, n) ) continue;
if( zName[n+1]==0 ) return 1;
if( zName[n+1]=='-' ){
for(j=n+2; zName[j] && fossil_isdigit(zName[j]); j++){}
if( zName[j]==0 ) return 1;
}
}
}
return 0;
}
#if INTERFACE
/*
** Values for the scanFlags parameter to vfile_scan().
*/
#define SCAN_ALL 0x001 /* Includes files that begin with "." */
#define SCAN_TEMP 0x002 /* Only Fossil-generated files like *-baseline */
#endif /* INTERFACE */
/*
** Load into table SFILE the name of every ordinary file in
** the directory pPath. Omit the first nPrefix characters of
** of pPath when inserting into the SFILE table.
**
** Subdirectories are scanned recursively.
** Omit files named in VFILE.
**
** Files whose names begin with "." are omitted unless allFlag is true.
**
** Any files or directories that match the glob pattern pIgnore are
** excluded from the scan. Name matching occurs after the first
** nPrefix characters are elided from the filename.
*/
void vfile_scan(Blob *pPath, int nPrefix, unsigned scanFlags, Glob *pIgnore){
DIR *d;
int origSize;
const char *zDir;
struct dirent *pEntry;
int skipAll = 0;
static Stmt ins;
static int depth = 0;
|
| ︙ | ︙ | |||
428 429 430 431 432 433 434 |
zMbcs = fossil_utf8_to_unicode(zDir);
d = opendir(zMbcs);
if( d ){
while( (pEntry=readdir(d))!=0 ){
char *zPath;
char *zUtf8;
if( pEntry->d_name[0]=='.' ){
| | | > | | | > | 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 495 496 497 498 499 |
zMbcs = fossil_utf8_to_unicode(zDir);
d = opendir(zMbcs);
if( d ){
while( (pEntry=readdir(d))!=0 ){
char *zPath;
char *zUtf8;
if( pEntry->d_name[0]=='.' ){
if( (scanFlags & SCAN_ALL)==0 ) continue;
if( pEntry->d_name[1]==0 ) continue;
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
}
zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
blob_appendf(pPath, "/%s", zUtf8);
fossil_mbcs_free(zUtf8);
zPath = blob_str(pPath);
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
/* do nothing */
}else if( file_wd_isdir(zPath)==1 ){
if( !vfile_top_of_checkout(zPath) ){
vfile_scan(pPath, nPrefix, scanFlags, pIgnore);
}
}else if( file_wd_isfile_or_link(zPath) ){
if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(pEntry->d_name) ){
db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
db_step(&ins);
db_reset(&ins);
}
}
blob_resize(pPath, origSize);
}
closedir(d);
}
fossil_mbcs_free(zMbcs);
|
| ︙ | ︙ |