Fossil SCM

Added -- support to (add, rm, mv).

stephan 2019-09-27 16:10 UTC double-dash-flag merge
Commit 9a7101d5dc96ec8812b2b5d9a9d6038daefe3ef45aebf0d5a6a1686084953bca
2 files changed +17 -10 +17 -10
+17 -10
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244244
}
245245
246246
/*
247247
** COMMAND: add
248248
**
249
-** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...?
249
+** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...?
250250
**
251251
** Make arrangements to add one or more files or directories to the
252252
** current checkout at the next commit.
253253
**
254254
** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276276
** -f|--force Add files without prompting
277277
** --ignore <CSG> Ignore unmanaged files matching patterns from
278278
** the comma separated list of glob patterns.
279279
** --clean <CSG> Also ignore files matching patterns from
280280
** the comma separated list of glob patterns.
281
+** -- Treat all following arguments as files,
282
+** even if they look like flags.
281283
**
282284
** See also: addremove, rm
283285
*/
284286
void add_cmd(void){
285287
int i; /* Loop counter */
@@ -295,11 +297,11 @@
295297
zIgnoreFlag = find_option("ignore",0,1);
296298
forceFlag = find_option("force","f",0)!=0;
297299
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
298300
299301
/* We should be done with options.. */
300
- verify_all_options();
302
+ verify_all_options2();
301303
302304
db_must_be_within_tree();
303305
if( zCleanFlag==0 ){
304306
zCleanFlag = db_get("clean-glob", 0);
305307
}
@@ -332,17 +334,18 @@
332334
if( isDir==1 ){
333335
vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
334336
}else if( isDir==0 ){
335337
fossil_warning("not found: %s", zName);
336338
}else{
337
- char *zTreeName = &zName[nRoot];
339
+ const char *zTreeName = &zName[nRoot];
338340
if( !forceFlag && glob_match(pIgnore, zTreeName) ){
339341
Blob ans;
340342
char cReply;
341343
char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
342344
"Add it (a=all/y/N)? ", zTreeName);
343345
prompt_user(prompt, &ans);
346
+ fossil_free(prompt);
344347
cReply = blob_str(&ans)[0];
345348
blob_reset(&ans);
346349
if( cReply=='a' || cReply=='A' ){
347350
forceFlag = 1;
348351
}else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
417420
/*
418421
** COMMAND: rm
419422
** COMMAND: delete
420423
** COMMAND: forget*
421424
**
422
-** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...?
425
+** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...?
423426
**
424427
** Remove one or more files or directories from the repository.
425428
**
426429
** The 'rm' and 'delete' commands do NOT normally remove the files from
427430
** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
441444
** --soft Skip removing files from the checkout.
442445
** This supersedes the --hard option.
443446
** --hard Remove files from the checkout.
444447
** --case-sensitive <BOOL> Override the case-sensitive setting.
445448
** -n|--dry-run If given, display instead of run actions.
449
+** -- Treat all following arguments as files,
450
+** even if they look like flags.
446451
**
447452
** See also: addremove, add
448453
*/
449454
void delete_cmd(void){
450455
int i;
@@ -457,11 +462,11 @@
457462
dryRunFlag = find_option("dry-run","n",0)!=0;
458463
softFlag = find_option("soft",0,0)!=0;
459464
hardFlag = find_option("hard",0,0)!=0;
460465
461466
/* We should be done with options.. */
462
- verify_all_options();
467
+ verify_all_options2();
463468
464469
db_must_be_within_tree();
465470
db_begin_transaction();
466471
if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
467472
removeFiles = 0;
@@ -823,12 +828,12 @@
823828
824829
/*
825830
** COMMAND: mv
826831
** COMMAND: rename*
827832
**
828
-** Usage: %fossil mv|rename OLDNAME NEWNAME
829
-** or: %fossil mv|rename OLDNAME... DIR
833
+** Usage: %fossil mv|rename ?OPTIONS? [--] OLDNAME NEWNAME
834
+** or: %fossil mv|rename ?OPTIONS? [--] OLDNAME... DIR
830835
**
831836
** Move or rename one or more files or directories within the repository tree.
832837
** You can either rename a file or directory or move it to another subdirectory.
833838
**
834839
** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
849854
** --soft Skip moving files within the checkout.
850855
** This supersedes the --hard option.
851856
** --hard Move files within the checkout.
852857
** --case-sensitive <BOOL> Override the case-sensitive setting.
853858
** -n|--dry-run If given, display instead of run actions.
859
+** -- Treat all following arguments as files,
860
+** even if they look like flags.
854861
**
855862
** See also: changes, status
856863
*/
857864
void mv_cmd(void){
858865
int i;
@@ -871,18 +878,18 @@
871878
dryRunFlag = find_option("dry-run","n",0)!=0;
872879
softFlag = find_option("soft",0,0)!=0;
873880
hardFlag = find_option("hard",0,0)!=0;
874881
875882
/* We should be done with options.. */
876
- verify_all_options();
883
+ verify_all_options2();
877884
878885
vid = db_lget_int("checkout", 0);
879886
if( vid==0 ){
880887
fossil_fatal("no checkout in which to rename files");
881888
}
882889
if( g.argc<4 ){
883
- usage("OLDNAME NEWNAME");
890
+ usage("?OPTIONS? [--] OLDNAME NEWNAME");
884891
}
885892
zDest = g.argv[g.argc-1];
886893
db_begin_transaction();
887894
if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
888895
moveFiles = 0;
@@ -909,11 +916,11 @@
909916
}else{
910917
origType = (file_isdir(g.argv[2], RepoFILE) == 1);
911918
}
912919
destType = file_isdir(zDest, RepoFILE);
913920
if( origType==-1 && destType!=1 ){
914
- usage("OLDNAME NEWNAME");
921
+ usage("?OPTIONS? [--] OLDNAME NEWNAME");
915922
}else if( origType==1 && destType==2 ){
916923
fossil_fatal("cannot rename '%s' to '%s' since another file named"
917924
" '%s' exists", g.argv[2], zDest, zDest);
918925
}else if( origType==0 && destType!=1 ){
919926
Blob orig;
920927
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244 }
245
246 /*
247 ** COMMAND: add
248 **
249 ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...?
250 **
251 ** Make arrangements to add one or more files or directories to the
252 ** current checkout at the next commit.
253 **
254 ** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
 
 
281 **
282 ** See also: addremove, rm
283 */
284 void add_cmd(void){
285 int i; /* Loop counter */
@@ -295,11 +297,11 @@
295 zIgnoreFlag = find_option("ignore",0,1);
296 forceFlag = find_option("force","f",0)!=0;
297 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
298
299 /* We should be done with options.. */
300 verify_all_options();
301
302 db_must_be_within_tree();
303 if( zCleanFlag==0 ){
304 zCleanFlag = db_get("clean-glob", 0);
305 }
@@ -332,17 +334,18 @@
332 if( isDir==1 ){
333 vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
334 }else if( isDir==0 ){
335 fossil_warning("not found: %s", zName);
336 }else{
337 char *zTreeName = &zName[nRoot];
338 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
339 Blob ans;
340 char cReply;
341 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
342 "Add it (a=all/y/N)? ", zTreeName);
343 prompt_user(prompt, &ans);
 
344 cReply = blob_str(&ans)[0];
345 blob_reset(&ans);
346 if( cReply=='a' || cReply=='A' ){
347 forceFlag = 1;
348 }else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
417 /*
418 ** COMMAND: rm
419 ** COMMAND: delete
420 ** COMMAND: forget*
421 **
422 ** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...?
423 **
424 ** Remove one or more files or directories from the repository.
425 **
426 ** The 'rm' and 'delete' commands do NOT normally remove the files from
427 ** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
441 ** --soft Skip removing files from the checkout.
442 ** This supersedes the --hard option.
443 ** --hard Remove files from the checkout.
444 ** --case-sensitive <BOOL> Override the case-sensitive setting.
445 ** -n|--dry-run If given, display instead of run actions.
 
 
446 **
447 ** See also: addremove, add
448 */
449 void delete_cmd(void){
450 int i;
@@ -457,11 +462,11 @@
457 dryRunFlag = find_option("dry-run","n",0)!=0;
458 softFlag = find_option("soft",0,0)!=0;
459 hardFlag = find_option("hard",0,0)!=0;
460
461 /* We should be done with options.. */
462 verify_all_options();
463
464 db_must_be_within_tree();
465 db_begin_transaction();
466 if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
467 removeFiles = 0;
@@ -823,12 +828,12 @@
823
824 /*
825 ** COMMAND: mv
826 ** COMMAND: rename*
827 **
828 ** Usage: %fossil mv|rename OLDNAME NEWNAME
829 ** or: %fossil mv|rename OLDNAME... DIR
830 **
831 ** Move or rename one or more files or directories within the repository tree.
832 ** You can either rename a file or directory or move it to another subdirectory.
833 **
834 ** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
849 ** --soft Skip moving files within the checkout.
850 ** This supersedes the --hard option.
851 ** --hard Move files within the checkout.
852 ** --case-sensitive <BOOL> Override the case-sensitive setting.
853 ** -n|--dry-run If given, display instead of run actions.
 
 
854 **
855 ** See also: changes, status
856 */
857 void mv_cmd(void){
858 int i;
@@ -871,18 +878,18 @@
871 dryRunFlag = find_option("dry-run","n",0)!=0;
872 softFlag = find_option("soft",0,0)!=0;
873 hardFlag = find_option("hard",0,0)!=0;
874
875 /* We should be done with options.. */
876 verify_all_options();
877
878 vid = db_lget_int("checkout", 0);
879 if( vid==0 ){
880 fossil_fatal("no checkout in which to rename files");
881 }
882 if( g.argc<4 ){
883 usage("OLDNAME NEWNAME");
884 }
885 zDest = g.argv[g.argc-1];
886 db_begin_transaction();
887 if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
888 moveFiles = 0;
@@ -909,11 +916,11 @@
909 }else{
910 origType = (file_isdir(g.argv[2], RepoFILE) == 1);
911 }
912 destType = file_isdir(zDest, RepoFILE);
913 if( origType==-1 && destType!=1 ){
914 usage("OLDNAME NEWNAME");
915 }else if( origType==1 && destType==2 ){
916 fossil_fatal("cannot rename '%s' to '%s' since another file named"
917 " '%s' exists", g.argv[2], zDest, zDest);
918 }else if( origType==0 && destType!=1 ){
919 Blob orig;
920
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244 }
245
246 /*
247 ** COMMAND: add
248 **
249 ** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...?
250 **
251 ** Make arrangements to add one or more files or directories to the
252 ** current checkout at the next commit.
253 **
254 ** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
281 ** -- Treat all following arguments as files,
282 ** even if they look like flags.
283 **
284 ** See also: addremove, rm
285 */
286 void add_cmd(void){
287 int i; /* Loop counter */
@@ -295,11 +297,11 @@
297 zIgnoreFlag = find_option("ignore",0,1);
298 forceFlag = find_option("force","f",0)!=0;
299 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
300
301 /* We should be done with options.. */
302 verify_all_options2();
303
304 db_must_be_within_tree();
305 if( zCleanFlag==0 ){
306 zCleanFlag = db_get("clean-glob", 0);
307 }
@@ -332,17 +334,18 @@
334 if( isDir==1 ){
335 vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
336 }else if( isDir==0 ){
337 fossil_warning("not found: %s", zName);
338 }else{
339 const char *zTreeName = &zName[nRoot];
340 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
341 Blob ans;
342 char cReply;
343 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
344 "Add it (a=all/y/N)? ", zTreeName);
345 prompt_user(prompt, &ans);
346 fossil_free(prompt);
347 cReply = blob_str(&ans)[0];
348 blob_reset(&ans);
349 if( cReply=='a' || cReply=='A' ){
350 forceFlag = 1;
351 }else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
420 /*
421 ** COMMAND: rm
422 ** COMMAND: delete
423 ** COMMAND: forget*
424 **
425 ** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...?
426 **
427 ** Remove one or more files or directories from the repository.
428 **
429 ** The 'rm' and 'delete' commands do NOT normally remove the files from
430 ** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
444 ** --soft Skip removing files from the checkout.
445 ** This supersedes the --hard option.
446 ** --hard Remove files from the checkout.
447 ** --case-sensitive <BOOL> Override the case-sensitive setting.
448 ** -n|--dry-run If given, display instead of run actions.
449 ** -- Treat all following arguments as files,
450 ** even if they look like flags.
451 **
452 ** See also: addremove, add
453 */
454 void delete_cmd(void){
455 int i;
@@ -457,11 +462,11 @@
462 dryRunFlag = find_option("dry-run","n",0)!=0;
463 softFlag = find_option("soft",0,0)!=0;
464 hardFlag = find_option("hard",0,0)!=0;
465
466 /* We should be done with options.. */
467 verify_all_options2();
468
469 db_must_be_within_tree();
470 db_begin_transaction();
471 if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
472 removeFiles = 0;
@@ -823,12 +828,12 @@
828
829 /*
830 ** COMMAND: mv
831 ** COMMAND: rename*
832 **
833 ** Usage: %fossil mv|rename ?OPTIONS? [--] OLDNAME NEWNAME
834 ** or: %fossil mv|rename ?OPTIONS? [--] OLDNAME... DIR
835 **
836 ** Move or rename one or more files or directories within the repository tree.
837 ** You can either rename a file or directory or move it to another subdirectory.
838 **
839 ** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
854 ** --soft Skip moving files within the checkout.
855 ** This supersedes the --hard option.
856 ** --hard Move files within the checkout.
857 ** --case-sensitive <BOOL> Override the case-sensitive setting.
858 ** -n|--dry-run If given, display instead of run actions.
859 ** -- Treat all following arguments as files,
860 ** even if they look like flags.
861 **
862 ** See also: changes, status
863 */
864 void mv_cmd(void){
865 int i;
@@ -871,18 +878,18 @@
878 dryRunFlag = find_option("dry-run","n",0)!=0;
879 softFlag = find_option("soft",0,0)!=0;
880 hardFlag = find_option("hard",0,0)!=0;
881
882 /* We should be done with options.. */
883 verify_all_options2();
884
885 vid = db_lget_int("checkout", 0);
886 if( vid==0 ){
887 fossil_fatal("no checkout in which to rename files");
888 }
889 if( g.argc<4 ){
890 usage("?OPTIONS? [--] OLDNAME NEWNAME");
891 }
892 zDest = g.argv[g.argc-1];
893 db_begin_transaction();
894 if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
895 moveFiles = 0;
@@ -909,11 +916,11 @@
916 }else{
917 origType = (file_isdir(g.argv[2], RepoFILE) == 1);
918 }
919 destType = file_isdir(zDest, RepoFILE);
920 if( origType==-1 && destType!=1 ){
921 usage("?OPTIONS? [--] OLDNAME NEWNAME");
922 }else if( origType==1 && destType==2 ){
923 fossil_fatal("cannot rename '%s' to '%s' since another file named"
924 " '%s' exists", g.argv[2], zDest, zDest);
925 }else if( origType==0 && destType!=1 ){
926 Blob orig;
927
+17 -10
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244244
}
245245
246246
/*
247247
** COMMAND: add
248248
**
249
-** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...?
249
+** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...?
250250
**
251251
** Make arrangements to add one or more files or directories to the
252252
** current checkout at the next commit.
253253
**
254254
** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276276
** -f|--force Add files without prompting
277277
** --ignore <CSG> Ignore unmanaged files matching patterns from
278278
** the comma separated list of glob patterns.
279279
** --clean <CSG> Also ignore files matching patterns from
280280
** the comma separated list of glob patterns.
281
+** -- Treat all following arguments as files,
282
+** even if they look like flags.
281283
**
282284
** See also: addremove, rm
283285
*/
284286
void add_cmd(void){
285287
int i; /* Loop counter */
@@ -295,11 +297,11 @@
295297
zIgnoreFlag = find_option("ignore",0,1);
296298
forceFlag = find_option("force","f",0)!=0;
297299
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
298300
299301
/* We should be done with options.. */
300
- verify_all_options();
302
+ verify_all_options2();
301303
302304
db_must_be_within_tree();
303305
if( zCleanFlag==0 ){
304306
zCleanFlag = db_get("clean-glob", 0);
305307
}
@@ -332,17 +334,18 @@
332334
if( isDir==1 ){
333335
vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
334336
}else if( isDir==0 ){
335337
fossil_warning("not found: %s", zName);
336338
}else{
337
- char *zTreeName = &zName[nRoot];
339
+ const char *zTreeName = &zName[nRoot];
338340
if( !forceFlag && glob_match(pIgnore, zTreeName) ){
339341
Blob ans;
340342
char cReply;
341343
char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
342344
"Add it (a=all/y/N)? ", zTreeName);
343345
prompt_user(prompt, &ans);
346
+ fossil_free(prompt);
344347
cReply = blob_str(&ans)[0];
345348
blob_reset(&ans);
346349
if( cReply=='a' || cReply=='A' ){
347350
forceFlag = 1;
348351
}else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
417420
/*
418421
** COMMAND: rm
419422
** COMMAND: delete
420423
** COMMAND: forget*
421424
**
422
-** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...?
425
+** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...?
423426
**
424427
** Remove one or more files or directories from the repository.
425428
**
426429
** The 'rm' and 'delete' commands do NOT normally remove the files from
427430
** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
441444
** --soft Skip removing files from the checkout.
442445
** This supersedes the --hard option.
443446
** --hard Remove files from the checkout.
444447
** --case-sensitive <BOOL> Override the case-sensitive setting.
445448
** -n|--dry-run If given, display instead of run actions.
449
+** -- Treat all following arguments as files,
450
+** even if they look like flags.
446451
**
447452
** See also: addremove, add
448453
*/
449454
void delete_cmd(void){
450455
int i;
@@ -457,11 +462,11 @@
457462
dryRunFlag = find_option("dry-run","n",0)!=0;
458463
softFlag = find_option("soft",0,0)!=0;
459464
hardFlag = find_option("hard",0,0)!=0;
460465
461466
/* We should be done with options.. */
462
- verify_all_options();
467
+ verify_all_options2();
463468
464469
db_must_be_within_tree();
465470
db_begin_transaction();
466471
if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
467472
removeFiles = 0;
@@ -823,12 +828,12 @@
823828
824829
/*
825830
** COMMAND: mv
826831
** COMMAND: rename*
827832
**
828
-** Usage: %fossil mv|rename OLDNAME NEWNAME
829
-** or: %fossil mv|rename OLDNAME... DIR
833
+** Usage: %fossil mv|rename ?OPTIONS? [--] OLDNAME NEWNAME
834
+** or: %fossil mv|rename ?OPTIONS? [--] OLDNAME... DIR
830835
**
831836
** Move or rename one or more files or directories within the repository tree.
832837
** You can either rename a file or directory or move it to another subdirectory.
833838
**
834839
** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
849854
** --soft Skip moving files within the checkout.
850855
** This supersedes the --hard option.
851856
** --hard Move files within the checkout.
852857
** --case-sensitive <BOOL> Override the case-sensitive setting.
853858
** -n|--dry-run If given, display instead of run actions.
859
+** -- Treat all following arguments as files,
860
+** even if they look like flags.
854861
**
855862
** See also: changes, status
856863
*/
857864
void mv_cmd(void){
858865
int i;
@@ -871,18 +878,18 @@
871878
dryRunFlag = find_option("dry-run","n",0)!=0;
872879
softFlag = find_option("soft",0,0)!=0;
873880
hardFlag = find_option("hard",0,0)!=0;
874881
875882
/* We should be done with options.. */
876
- verify_all_options();
883
+ verify_all_options2();
877884
878885
vid = db_lget_int("checkout", 0);
879886
if( vid==0 ){
880887
fossil_fatal("no checkout in which to rename files");
881888
}
882889
if( g.argc<4 ){
883
- usage("OLDNAME NEWNAME");
890
+ usage("?OPTIONS? [--] OLDNAME NEWNAME");
884891
}
885892
zDest = g.argv[g.argc-1];
886893
db_begin_transaction();
887894
if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
888895
moveFiles = 0;
@@ -909,11 +916,11 @@
909916
}else{
910917
origType = (file_isdir(g.argv[2], RepoFILE) == 1);
911918
}
912919
destType = file_isdir(zDest, RepoFILE);
913920
if( origType==-1 && destType!=1 ){
914
- usage("OLDNAME NEWNAME");
921
+ usage("?OPTIONS? [--] OLDNAME NEWNAME");
915922
}else if( origType==1 && destType==2 ){
916923
fossil_fatal("cannot rename '%s' to '%s' since another file named"
917924
" '%s' exists", g.argv[2], zDest, zDest);
918925
}else if( origType==0 && destType!=1 ){
919926
Blob orig;
920927
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244 }
245
246 /*
247 ** COMMAND: add
248 **
249 ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...?
250 **
251 ** Make arrangements to add one or more files or directories to the
252 ** current checkout at the next commit.
253 **
254 ** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
 
 
281 **
282 ** See also: addremove, rm
283 */
284 void add_cmd(void){
285 int i; /* Loop counter */
@@ -295,11 +297,11 @@
295 zIgnoreFlag = find_option("ignore",0,1);
296 forceFlag = find_option("force","f",0)!=0;
297 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
298
299 /* We should be done with options.. */
300 verify_all_options();
301
302 db_must_be_within_tree();
303 if( zCleanFlag==0 ){
304 zCleanFlag = db_get("clean-glob", 0);
305 }
@@ -332,17 +334,18 @@
332 if( isDir==1 ){
333 vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
334 }else if( isDir==0 ){
335 fossil_warning("not found: %s", zName);
336 }else{
337 char *zTreeName = &zName[nRoot];
338 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
339 Blob ans;
340 char cReply;
341 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
342 "Add it (a=all/y/N)? ", zTreeName);
343 prompt_user(prompt, &ans);
 
344 cReply = blob_str(&ans)[0];
345 blob_reset(&ans);
346 if( cReply=='a' || cReply=='A' ){
347 forceFlag = 1;
348 }else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
417 /*
418 ** COMMAND: rm
419 ** COMMAND: delete
420 ** COMMAND: forget*
421 **
422 ** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...?
423 **
424 ** Remove one or more files or directories from the repository.
425 **
426 ** The 'rm' and 'delete' commands do NOT normally remove the files from
427 ** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
441 ** --soft Skip removing files from the checkout.
442 ** This supersedes the --hard option.
443 ** --hard Remove files from the checkout.
444 ** --case-sensitive <BOOL> Override the case-sensitive setting.
445 ** -n|--dry-run If given, display instead of run actions.
 
 
446 **
447 ** See also: addremove, add
448 */
449 void delete_cmd(void){
450 int i;
@@ -457,11 +462,11 @@
457 dryRunFlag = find_option("dry-run","n",0)!=0;
458 softFlag = find_option("soft",0,0)!=0;
459 hardFlag = find_option("hard",0,0)!=0;
460
461 /* We should be done with options.. */
462 verify_all_options();
463
464 db_must_be_within_tree();
465 db_begin_transaction();
466 if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
467 removeFiles = 0;
@@ -823,12 +828,12 @@
823
824 /*
825 ** COMMAND: mv
826 ** COMMAND: rename*
827 **
828 ** Usage: %fossil mv|rename OLDNAME NEWNAME
829 ** or: %fossil mv|rename OLDNAME... DIR
830 **
831 ** Move or rename one or more files or directories within the repository tree.
832 ** You can either rename a file or directory or move it to another subdirectory.
833 **
834 ** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
849 ** --soft Skip moving files within the checkout.
850 ** This supersedes the --hard option.
851 ** --hard Move files within the checkout.
852 ** --case-sensitive <BOOL> Override the case-sensitive setting.
853 ** -n|--dry-run If given, display instead of run actions.
 
 
854 **
855 ** See also: changes, status
856 */
857 void mv_cmd(void){
858 int i;
@@ -871,18 +878,18 @@
871 dryRunFlag = find_option("dry-run","n",0)!=0;
872 softFlag = find_option("soft",0,0)!=0;
873 hardFlag = find_option("hard",0,0)!=0;
874
875 /* We should be done with options.. */
876 verify_all_options();
877
878 vid = db_lget_int("checkout", 0);
879 if( vid==0 ){
880 fossil_fatal("no checkout in which to rename files");
881 }
882 if( g.argc<4 ){
883 usage("OLDNAME NEWNAME");
884 }
885 zDest = g.argv[g.argc-1];
886 db_begin_transaction();
887 if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
888 moveFiles = 0;
@@ -909,11 +916,11 @@
909 }else{
910 origType = (file_isdir(g.argv[2], RepoFILE) == 1);
911 }
912 destType = file_isdir(zDest, RepoFILE);
913 if( origType==-1 && destType!=1 ){
914 usage("OLDNAME NEWNAME");
915 }else if( origType==1 && destType==2 ){
916 fossil_fatal("cannot rename '%s' to '%s' since another file named"
917 " '%s' exists", g.argv[2], zDest, zDest);
918 }else if( origType==0 && destType!=1 ){
919 Blob orig;
920
--- src/add.c
+++ src/add.c
@@ -244,11 +244,11 @@
244 }
245
246 /*
247 ** COMMAND: add
248 **
249 ** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...?
250 **
251 ** Make arrangements to add one or more files or directories to the
252 ** current checkout at the next commit.
253 **
254 ** When adding files or directories recursively, filenames that begin
@@ -276,10 +276,12 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
281 ** -- Treat all following arguments as files,
282 ** even if they look like flags.
283 **
284 ** See also: addremove, rm
285 */
286 void add_cmd(void){
287 int i; /* Loop counter */
@@ -295,11 +297,11 @@
297 zIgnoreFlag = find_option("ignore",0,1);
298 forceFlag = find_option("force","f",0)!=0;
299 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
300
301 /* We should be done with options.. */
302 verify_all_options2();
303
304 db_must_be_within_tree();
305 if( zCleanFlag==0 ){
306 zCleanFlag = db_get("clean-glob", 0);
307 }
@@ -332,17 +334,18 @@
334 if( isDir==1 ){
335 vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
336 }else if( isDir==0 ){
337 fossil_warning("not found: %s", zName);
338 }else{
339 const char *zTreeName = &zName[nRoot];
340 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
341 Blob ans;
342 char cReply;
343 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
344 "Add it (a=all/y/N)? ", zTreeName);
345 prompt_user(prompt, &ans);
346 fossil_free(prompt);
347 cReply = blob_str(&ans)[0];
348 blob_reset(&ans);
349 if( cReply=='a' || cReply=='A' ){
350 forceFlag = 1;
351 }else if( cReply!='y' && cReply!='Y' ){
@@ -417,11 +420,11 @@
420 /*
421 ** COMMAND: rm
422 ** COMMAND: delete
423 ** COMMAND: forget*
424 **
425 ** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...?
426 **
427 ** Remove one or more files or directories from the repository.
428 **
429 ** The 'rm' and 'delete' commands do NOT normally remove the files from
430 ** disk. They just mark the files as no longer being part of the project.
@@ -441,10 +444,12 @@
444 ** --soft Skip removing files from the checkout.
445 ** This supersedes the --hard option.
446 ** --hard Remove files from the checkout.
447 ** --case-sensitive <BOOL> Override the case-sensitive setting.
448 ** -n|--dry-run If given, display instead of run actions.
449 ** -- Treat all following arguments as files,
450 ** even if they look like flags.
451 **
452 ** See also: addremove, add
453 */
454 void delete_cmd(void){
455 int i;
@@ -457,11 +462,11 @@
462 dryRunFlag = find_option("dry-run","n",0)!=0;
463 softFlag = find_option("soft",0,0)!=0;
464 hardFlag = find_option("hard",0,0)!=0;
465
466 /* We should be done with options.. */
467 verify_all_options2();
468
469 db_must_be_within_tree();
470 db_begin_transaction();
471 if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
472 removeFiles = 0;
@@ -823,12 +828,12 @@
828
829 /*
830 ** COMMAND: mv
831 ** COMMAND: rename*
832 **
833 ** Usage: %fossil mv|rename ?OPTIONS? [--] OLDNAME NEWNAME
834 ** or: %fossil mv|rename ?OPTIONS? [--] OLDNAME... DIR
835 **
836 ** Move or rename one or more files or directories within the repository tree.
837 ** You can either rename a file or directory or move it to another subdirectory.
838 **
839 ** The 'mv' command does NOT normally rename or move the files on disk.
@@ -849,10 +854,12 @@
854 ** --soft Skip moving files within the checkout.
855 ** This supersedes the --hard option.
856 ** --hard Move files within the checkout.
857 ** --case-sensitive <BOOL> Override the case-sensitive setting.
858 ** -n|--dry-run If given, display instead of run actions.
859 ** -- Treat all following arguments as files,
860 ** even if they look like flags.
861 **
862 ** See also: changes, status
863 */
864 void mv_cmd(void){
865 int i;
@@ -871,18 +878,18 @@
878 dryRunFlag = find_option("dry-run","n",0)!=0;
879 softFlag = find_option("soft",0,0)!=0;
880 hardFlag = find_option("hard",0,0)!=0;
881
882 /* We should be done with options.. */
883 verify_all_options2();
884
885 vid = db_lget_int("checkout", 0);
886 if( vid==0 ){
887 fossil_fatal("no checkout in which to rename files");
888 }
889 if( g.argc<4 ){
890 usage("?OPTIONS? [--] OLDNAME NEWNAME");
891 }
892 zDest = g.argv[g.argc-1];
893 db_begin_transaction();
894 if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
895 moveFiles = 0;
@@ -909,11 +916,11 @@
916 }else{
917 origType = (file_isdir(g.argv[2], RepoFILE) == 1);
918 }
919 destType = file_isdir(zDest, RepoFILE);
920 if( origType==-1 && destType!=1 ){
921 usage("?OPTIONS? [--] OLDNAME NEWNAME");
922 }else if( origType==1 && destType==2 ){
923 fossil_fatal("cannot rename '%s' to '%s' since another file named"
924 " '%s' exists", g.argv[2], zDest, zDest);
925 }else if( origType==0 && destType!=1 ){
926 Blob orig;
927

Keyboard Shortcuts

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