Fossil SCM

Add option --case-sensitive to "fossil delete". On case-insensitive filesystems now you can "fossil delete src/FOO.c", which results in src/foo.c being prepared from removal. This doesn't work yet for directories.

jan.nijtmans 2013-05-31 07:12 trunk
Commit 7ae19e56ba36cd30480ecf30a46e20726e662f3b
1 file changed +12 -5
+12 -5
--- src/add.c
+++ src/add.c
@@ -267,11 +267,12 @@
267267
vid = db_lget_int("checkout",0);
268268
if( vid==0 ){
269269
fossil_panic("no checkout to add to");
270270
}
271271
db_begin_transaction();
272
- db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
272
+ db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
273
+ filename_collation());
273274
pClean = glob_create(zCleanFlag);
274275
pIgnore = glob_create(zIgnoreFlag);
275276
nRoot = strlen(g.zLocalRoot);
276277
277278
/* Load the names of all files that are to be added into sfile temp table */
@@ -316,37 +317,42 @@
316317
**
317318
** This command does NOT remove the files from disk. It just marks the
318319
** files as no longer being part of the project. In other words, future
319320
** changes to the named files will not be versioned.
320321
**
322
+** Options:
323
+** --case-sensitive <BOOL> override case-sensitive setting
324
+**
321325
** See also: addremove, add
322326
*/
323327
void delete_cmd(void){
324328
int i;
325329
int vid;
326330
Stmt loop;
327331
332
+ capture_case_sensitive_option();
328333
db_must_be_within_tree();
329334
vid = db_lget_int("checkout", 0);
330335
if( vid==0 ){
331336
fossil_panic("no checkout to remove from");
332337
}
333338
db_begin_transaction();
334
- db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
339
+ db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
340
+ filename_collation());
335341
for(i=2; i<g.argc; i++){
336342
Blob treeName;
337343
char *zTreeName;
338344
339345
file_tree_name(g.argv[i], &treeName, 1);
340346
zTreeName = blob_str(&treeName);
341347
db_multi_exec(
342348
"INSERT OR IGNORE INTO sfile"
343349
" SELECT pathname FROM vfile"
344
- " WHERE (pathname=%Q"
350
+ " WHERE (pathname=%Q %s"
345351
" OR (pathname>'%q/' AND pathname<'%q0'))"
346352
" AND NOT deleted",
347
- zTreeName, zTreeName, zTreeName
353
+ zTreeName, filename_collation(), zTreeName, zTreeName
348354
);
349355
blob_reset(&treeName);
350356
}
351357
352358
db_prepare(&loop, "SELECT x FROM sfile");
@@ -509,11 +515,12 @@
509515
** Populate the temp table "sfile" with the names of all unmanaged
510516
** files currently in the check-out, except for files that match the
511517
** --ignore or ignore-glob patterns and dot-files. Then add all of
512518
** the files in the sfile temp table to the set of managed files.
513519
*/
514
- db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
520
+ db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
521
+ filename_collation());
515522
n = strlen(g.zLocalRoot);
516523
blob_init(&path, g.zLocalRoot, n-1);
517524
/* now we read the complete file structure into a temp table */
518525
pClean = glob_create(zCleanFlag);
519526
pIgnore = glob_create(zIgnoreFlag);
520527
--- src/add.c
+++ src/add.c
@@ -267,11 +267,12 @@
267 vid = db_lget_int("checkout",0);
268 if( vid==0 ){
269 fossil_panic("no checkout to add to");
270 }
271 db_begin_transaction();
272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
 
273 pClean = glob_create(zCleanFlag);
274 pIgnore = glob_create(zIgnoreFlag);
275 nRoot = strlen(g.zLocalRoot);
276
277 /* Load the names of all files that are to be added into sfile temp table */
@@ -316,37 +317,42 @@
316 **
317 ** This command does NOT remove the files from disk. It just marks the
318 ** files as no longer being part of the project. In other words, future
319 ** changes to the named files will not be versioned.
320 **
 
 
 
321 ** See also: addremove, add
322 */
323 void delete_cmd(void){
324 int i;
325 int vid;
326 Stmt loop;
327
 
328 db_must_be_within_tree();
329 vid = db_lget_int("checkout", 0);
330 if( vid==0 ){
331 fossil_panic("no checkout to remove from");
332 }
333 db_begin_transaction();
334 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
 
335 for(i=2; i<g.argc; i++){
336 Blob treeName;
337 char *zTreeName;
338
339 file_tree_name(g.argv[i], &treeName, 1);
340 zTreeName = blob_str(&treeName);
341 db_multi_exec(
342 "INSERT OR IGNORE INTO sfile"
343 " SELECT pathname FROM vfile"
344 " WHERE (pathname=%Q"
345 " OR (pathname>'%q/' AND pathname<'%q0'))"
346 " AND NOT deleted",
347 zTreeName, zTreeName, zTreeName
348 );
349 blob_reset(&treeName);
350 }
351
352 db_prepare(&loop, "SELECT x FROM sfile");
@@ -509,11 +515,12 @@
509 ** Populate the temp table "sfile" with the names of all unmanaged
510 ** files currently in the check-out, except for files that match the
511 ** --ignore or ignore-glob patterns and dot-files. Then add all of
512 ** the files in the sfile temp table to the set of managed files.
513 */
514 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
 
515 n = strlen(g.zLocalRoot);
516 blob_init(&path, g.zLocalRoot, n-1);
517 /* now we read the complete file structure into a temp table */
518 pClean = glob_create(zCleanFlag);
519 pIgnore = glob_create(zIgnoreFlag);
520
--- src/add.c
+++ src/add.c
@@ -267,11 +267,12 @@
267 vid = db_lget_int("checkout",0);
268 if( vid==0 ){
269 fossil_panic("no checkout to add to");
270 }
271 db_begin_transaction();
272 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
273 filename_collation());
274 pClean = glob_create(zCleanFlag);
275 pIgnore = glob_create(zIgnoreFlag);
276 nRoot = strlen(g.zLocalRoot);
277
278 /* Load the names of all files that are to be added into sfile temp table */
@@ -316,37 +317,42 @@
317 **
318 ** This command does NOT remove the files from disk. It just marks the
319 ** files as no longer being part of the project. In other words, future
320 ** changes to the named files will not be versioned.
321 **
322 ** Options:
323 ** --case-sensitive <BOOL> override case-sensitive setting
324 **
325 ** See also: addremove, add
326 */
327 void delete_cmd(void){
328 int i;
329 int vid;
330 Stmt loop;
331
332 capture_case_sensitive_option();
333 db_must_be_within_tree();
334 vid = db_lget_int("checkout", 0);
335 if( vid==0 ){
336 fossil_panic("no checkout to remove from");
337 }
338 db_begin_transaction();
339 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
340 filename_collation());
341 for(i=2; i<g.argc; i++){
342 Blob treeName;
343 char *zTreeName;
344
345 file_tree_name(g.argv[i], &treeName, 1);
346 zTreeName = blob_str(&treeName);
347 db_multi_exec(
348 "INSERT OR IGNORE INTO sfile"
349 " SELECT pathname FROM vfile"
350 " WHERE (pathname=%Q %s"
351 " OR (pathname>'%q/' AND pathname<'%q0'))"
352 " AND NOT deleted",
353 zTreeName, filename_collation(), zTreeName, zTreeName
354 );
355 blob_reset(&treeName);
356 }
357
358 db_prepare(&loop, "SELECT x FROM sfile");
@@ -509,11 +515,12 @@
515 ** Populate the temp table "sfile" with the names of all unmanaged
516 ** files currently in the check-out, except for files that match the
517 ** --ignore or ignore-glob patterns and dot-files. Then add all of
518 ** the files in the sfile temp table to the set of managed files.
519 */
520 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
521 filename_collation());
522 n = strlen(g.zLocalRoot);
523 blob_init(&path, g.zLocalRoot, n-1);
524 /* now we read the complete file structure into a temp table */
525 pClean = glob_create(zCleanFlag);
526 pIgnore = glob_create(zIgnoreFlag);
527

Keyboard Shortcuts

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