Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Incorporate the "addremove" command (with edits) from the StvPrivateHook2 branch. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
ceab53718f40e0a19c5350bed85ddadc |
| User & Date: | drh 2010-11-12 16:37:37.000 |
Context
|
2010-11-12
| ||
| 20:57 | Fixed typos reported by ticket [a3336458f6864db0404b6d45b144be0b17526fb0]. ... (check-in: 03b53ca4ca user: aku tags: trunk) | |
| 16:37 | Incorporate the "addremove" command (with edits) from the StvPrivateHook2 branch. ... (check-in: ceab53718f user: drh tags: trunk) | |
| 15:17 | A simple tweak to the graph javascript gets it working on IE6. Ticket [a734fe24da8f75758cf] ... (check-in: e0eceb7892 user: drh tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
42 43 44 45 46 47 48 | || strcmp(zPath, "_FOSSIL_-journal")==0 || strcmp(zPath, "_FOSSIL_-wal")==0 || strcmp(zPath, "_FOSSIL_-shm")==0 || strcmp(zPath, ".fos")==0 || strcmp(zPath, ".fos-journal")==0 || strcmp(zPath, ".fos-wal")==0 || strcmp(zPath, ".fos-shm")==0 | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|| strcmp(zPath, "_FOSSIL_-journal")==0
|| strcmp(zPath, "_FOSSIL_-wal")==0
|| strcmp(zPath, "_FOSSIL_-shm")==0
|| strcmp(zPath, ".fos")==0
|| strcmp(zPath, ".fos-journal")==0
|| strcmp(zPath, ".fos-wal")==0
|| strcmp(zPath, ".fos-shm")==0
|| (pOmit && blob_compare(&pathname, pOmit)==0)
){
fossil_warning("cannot add %s", zPath);
}else{
if( !file_is_simple_pathname(zPath) ){
fossil_fatal("filename contains illegal characters: %s", zPath);
}
#if defined(_WIN32)
|
| ︙ | ︙ | |||
269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
blob_reset(&pathname);
}
free(zName);
}
db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
db_end_transaction(0);
}
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
*/
static void mv_one_file(int vid, const char *zOrig, const char *zNew){
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
blob_reset(&pathname);
}
free(zName);
}
db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
db_end_transaction(0);
}
/*
** COMMAND: addremove
**
** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
**
** Do all necessary "add" and "rm" commands to synchronize the repository
** with the content of the working checkout
**
** * All files in the checkout but not in the repository (that is,
** all files displayed using the "extra" command) are added as
** if by the "add" command.
**
** * All files in the repository but missing from the checkout (that is,
** all files that show as MISSING with the "status" command) are
** removed as if by the "rm" command.
**
** The command does not "commit". You must run the "commit" separately
** as a separate step.
**
** Files and directories whose names begin with "." are ignored unless
** the --dotfiles option is used.
**
** The --ignore option overrides the "ignore-glob" setting. See
** documentation on the "setting" command for further information.
**
** The --test option shows what would happen without actually doing anything.
**
** This command can be used to track third party software.
*/
void import_cmd(void){
Blob path;
const char *zIgnoreFlag = find_option("ignore",0,1);
int allFlag = find_option("dotfiles",0,0)!=0;
int isTest = find_option("test",0,0)!=0;
int n;
Stmt q;
int vid;
Blob repo;
int nAdd = 0;
int nDelete = 0;
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
db_must_be_within_tree();
vid = db_lget_int("checkout",0);
if( vid==0 ){
fossil_panic("no checkout to add to");
}
db_begin_transaction();
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 */
vfile_scan(0, &path, blob_size(&path), allFlag);
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
}
/* step 1: search for extra files */
db_prepare(&q,
"SELECT x, %Q || x FROM sfile"
" WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_',"
"'_FOSSIL_-journal','.fos','.fos-journal',"
"'_FOSSIL_-wal','_FOSSIL_-shm','.fos-wal',"
"'.fos-shm')"
" AND NOT %s"
" ORDER BY 1",
g.zLocalRoot,
glob_expr("x", zIgnoreFlag)
);
while( db_step(&q)==SQLITE_ROW ){
add_one_file(db_column_text(&q, 1), vid, 0);
nAdd++;
}
db_finalize(&q);
/* step 2: search for missing files */
db_prepare(&q,
"SELECT pathname,%Q || pathname,deleted FROM vfile"
" WHERE deleted!=1"
" ORDER BY 1",
g.zLocalRoot
);
while( db_step(&q)==SQLITE_ROW ){
const char * zFile;
const char * zPath;
zFile = db_column_text(&q, 0);
zPath = db_column_text(&q, 1);
if( !file_isfile(zPath) ){
if( !isTest ){
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
}
printf("DELETED %s\n", zFile);
nDelete++;
}
}
db_finalize(&q);
/* show cmmand summary */
printf("added %d files, deleted %d files\n", nAdd, nDelete);
db_end_transaction(isTest);
}
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
*/
static void mv_one_file(int vid, const char *zOrig, const char *zNew){
|
| ︙ | ︙ |