Fossil SCM
Added -- support to (add, rm, mv).
Commit
9a7101d5dc96ec8812b2b5d9a9d6038daefe3ef45aebf0d5a6a1686084953bca
Parent
dba4fd9b69c5d8c…
2 files changed
+17
-10
+17
-10
+17
-10
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -244,11 +244,11 @@ | ||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /* |
| 247 | 247 | ** COMMAND: add |
| 248 | 248 | ** |
| 249 | -** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? | |
| 249 | +** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...? | |
| 250 | 250 | ** |
| 251 | 251 | ** Make arrangements to add one or more files or directories to the |
| 252 | 252 | ** current checkout at the next commit. |
| 253 | 253 | ** |
| 254 | 254 | ** When adding files or directories recursively, filenames that begin |
| @@ -276,10 +276,12 @@ | ||
| 276 | 276 | ** -f|--force Add files without prompting |
| 277 | 277 | ** --ignore <CSG> Ignore unmanaged files matching patterns from |
| 278 | 278 | ** the comma separated list of glob patterns. |
| 279 | 279 | ** --clean <CSG> Also ignore files matching patterns from |
| 280 | 280 | ** the comma separated list of glob patterns. |
| 281 | +** -- Treat all following arguments as files, | |
| 282 | +** even if they look like flags. | |
| 281 | 283 | ** |
| 282 | 284 | ** See also: addremove, rm |
| 283 | 285 | */ |
| 284 | 286 | void add_cmd(void){ |
| 285 | 287 | int i; /* Loop counter */ |
| @@ -295,11 +297,11 @@ | ||
| 295 | 297 | zIgnoreFlag = find_option("ignore",0,1); |
| 296 | 298 | forceFlag = find_option("force","f",0)!=0; |
| 297 | 299 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 298 | 300 | |
| 299 | 301 | /* We should be done with options.. */ |
| 300 | - verify_all_options(); | |
| 302 | + verify_all_options2(); | |
| 301 | 303 | |
| 302 | 304 | db_must_be_within_tree(); |
| 303 | 305 | if( zCleanFlag==0 ){ |
| 304 | 306 | zCleanFlag = db_get("clean-glob", 0); |
| 305 | 307 | } |
| @@ -332,17 +334,18 @@ | ||
| 332 | 334 | if( isDir==1 ){ |
| 333 | 335 | vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE); |
| 334 | 336 | }else if( isDir==0 ){ |
| 335 | 337 | fossil_warning("not found: %s", zName); |
| 336 | 338 | }else{ |
| 337 | - char *zTreeName = &zName[nRoot]; | |
| 339 | + const char *zTreeName = &zName[nRoot]; | |
| 338 | 340 | if( !forceFlag && glob_match(pIgnore, zTreeName) ){ |
| 339 | 341 | Blob ans; |
| 340 | 342 | char cReply; |
| 341 | 343 | char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". " |
| 342 | 344 | "Add it (a=all/y/N)? ", zTreeName); |
| 343 | 345 | prompt_user(prompt, &ans); |
| 346 | + fossil_free(prompt); | |
| 344 | 347 | cReply = blob_str(&ans)[0]; |
| 345 | 348 | blob_reset(&ans); |
| 346 | 349 | if( cReply=='a' || cReply=='A' ){ |
| 347 | 350 | forceFlag = 1; |
| 348 | 351 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -417,11 +420,11 @@ | ||
| 417 | 420 | /* |
| 418 | 421 | ** COMMAND: rm |
| 419 | 422 | ** COMMAND: delete |
| 420 | 423 | ** COMMAND: forget* |
| 421 | 424 | ** |
| 422 | -** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...? | |
| 425 | +** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...? | |
| 423 | 426 | ** |
| 424 | 427 | ** Remove one or more files or directories from the repository. |
| 425 | 428 | ** |
| 426 | 429 | ** The 'rm' and 'delete' commands do NOT normally remove the files from |
| 427 | 430 | ** disk. They just mark the files as no longer being part of the project. |
| @@ -441,10 +444,12 @@ | ||
| 441 | 444 | ** --soft Skip removing files from the checkout. |
| 442 | 445 | ** This supersedes the --hard option. |
| 443 | 446 | ** --hard Remove files from the checkout. |
| 444 | 447 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 445 | 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. | |
| 446 | 451 | ** |
| 447 | 452 | ** See also: addremove, add |
| 448 | 453 | */ |
| 449 | 454 | void delete_cmd(void){ |
| 450 | 455 | int i; |
| @@ -457,11 +462,11 @@ | ||
| 457 | 462 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 458 | 463 | softFlag = find_option("soft",0,0)!=0; |
| 459 | 464 | hardFlag = find_option("hard",0,0)!=0; |
| 460 | 465 | |
| 461 | 466 | /* We should be done with options.. */ |
| 462 | - verify_all_options(); | |
| 467 | + verify_all_options2(); | |
| 463 | 468 | |
| 464 | 469 | db_must_be_within_tree(); |
| 465 | 470 | db_begin_transaction(); |
| 466 | 471 | if( g.argv[1][0]=='f' ){ /* i.e. "forget" */ |
| 467 | 472 | removeFiles = 0; |
| @@ -823,12 +828,12 @@ | ||
| 823 | 828 | |
| 824 | 829 | /* |
| 825 | 830 | ** COMMAND: mv |
| 826 | 831 | ** COMMAND: rename* |
| 827 | 832 | ** |
| 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 | |
| 830 | 835 | ** |
| 831 | 836 | ** Move or rename one or more files or directories within the repository tree. |
| 832 | 837 | ** You can either rename a file or directory or move it to another subdirectory. |
| 833 | 838 | ** |
| 834 | 839 | ** The 'mv' command does NOT normally rename or move the files on disk. |
| @@ -849,10 +854,12 @@ | ||
| 849 | 854 | ** --soft Skip moving files within the checkout. |
| 850 | 855 | ** This supersedes the --hard option. |
| 851 | 856 | ** --hard Move files within the checkout. |
| 852 | 857 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 853 | 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. | |
| 854 | 861 | ** |
| 855 | 862 | ** See also: changes, status |
| 856 | 863 | */ |
| 857 | 864 | void mv_cmd(void){ |
| 858 | 865 | int i; |
| @@ -871,18 +878,18 @@ | ||
| 871 | 878 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 872 | 879 | softFlag = find_option("soft",0,0)!=0; |
| 873 | 880 | hardFlag = find_option("hard",0,0)!=0; |
| 874 | 881 | |
| 875 | 882 | /* We should be done with options.. */ |
| 876 | - verify_all_options(); | |
| 883 | + verify_all_options2(); | |
| 877 | 884 | |
| 878 | 885 | vid = db_lget_int("checkout", 0); |
| 879 | 886 | if( vid==0 ){ |
| 880 | 887 | fossil_fatal("no checkout in which to rename files"); |
| 881 | 888 | } |
| 882 | 889 | if( g.argc<4 ){ |
| 883 | - usage("OLDNAME NEWNAME"); | |
| 890 | + usage("?OPTIONS? [--] OLDNAME NEWNAME"); | |
| 884 | 891 | } |
| 885 | 892 | zDest = g.argv[g.argc-1]; |
| 886 | 893 | db_begin_transaction(); |
| 887 | 894 | if( g.argv[1][0]=='r' ){ /* i.e. "rename" */ |
| 888 | 895 | moveFiles = 0; |
| @@ -909,11 +916,11 @@ | ||
| 909 | 916 | }else{ |
| 910 | 917 | origType = (file_isdir(g.argv[2], RepoFILE) == 1); |
| 911 | 918 | } |
| 912 | 919 | destType = file_isdir(zDest, RepoFILE); |
| 913 | 920 | if( origType==-1 && destType!=1 ){ |
| 914 | - usage("OLDNAME NEWNAME"); | |
| 921 | + usage("?OPTIONS? [--] OLDNAME NEWNAME"); | |
| 915 | 922 | }else if( origType==1 && destType==2 ){ |
| 916 | 923 | fossil_fatal("cannot rename '%s' to '%s' since another file named" |
| 917 | 924 | " '%s' exists", g.argv[2], zDest, zDest); |
| 918 | 925 | }else if( origType==0 && destType!=1 ){ |
| 919 | 926 | Blob orig; |
| 920 | 927 |
| --- 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 @@ | ||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /* |
| 247 | 247 | ** COMMAND: add |
| 248 | 248 | ** |
| 249 | -** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? | |
| 249 | +** Usage: %fossil add ?OPTIONS? [--] FILE1 ?FILE2 ...? | |
| 250 | 250 | ** |
| 251 | 251 | ** Make arrangements to add one or more files or directories to the |
| 252 | 252 | ** current checkout at the next commit. |
| 253 | 253 | ** |
| 254 | 254 | ** When adding files or directories recursively, filenames that begin |
| @@ -276,10 +276,12 @@ | ||
| 276 | 276 | ** -f|--force Add files without prompting |
| 277 | 277 | ** --ignore <CSG> Ignore unmanaged files matching patterns from |
| 278 | 278 | ** the comma separated list of glob patterns. |
| 279 | 279 | ** --clean <CSG> Also ignore files matching patterns from |
| 280 | 280 | ** the comma separated list of glob patterns. |
| 281 | +** -- Treat all following arguments as files, | |
| 282 | +** even if they look like flags. | |
| 281 | 283 | ** |
| 282 | 284 | ** See also: addremove, rm |
| 283 | 285 | */ |
| 284 | 286 | void add_cmd(void){ |
| 285 | 287 | int i; /* Loop counter */ |
| @@ -295,11 +297,11 @@ | ||
| 295 | 297 | zIgnoreFlag = find_option("ignore",0,1); |
| 296 | 298 | forceFlag = find_option("force","f",0)!=0; |
| 297 | 299 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 298 | 300 | |
| 299 | 301 | /* We should be done with options.. */ |
| 300 | - verify_all_options(); | |
| 302 | + verify_all_options2(); | |
| 301 | 303 | |
| 302 | 304 | db_must_be_within_tree(); |
| 303 | 305 | if( zCleanFlag==0 ){ |
| 304 | 306 | zCleanFlag = db_get("clean-glob", 0); |
| 305 | 307 | } |
| @@ -332,17 +334,18 @@ | ||
| 332 | 334 | if( isDir==1 ){ |
| 333 | 335 | vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE); |
| 334 | 336 | }else if( isDir==0 ){ |
| 335 | 337 | fossil_warning("not found: %s", zName); |
| 336 | 338 | }else{ |
| 337 | - char *zTreeName = &zName[nRoot]; | |
| 339 | + const char *zTreeName = &zName[nRoot]; | |
| 338 | 340 | if( !forceFlag && glob_match(pIgnore, zTreeName) ){ |
| 339 | 341 | Blob ans; |
| 340 | 342 | char cReply; |
| 341 | 343 | char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". " |
| 342 | 344 | "Add it (a=all/y/N)? ", zTreeName); |
| 343 | 345 | prompt_user(prompt, &ans); |
| 346 | + fossil_free(prompt); | |
| 344 | 347 | cReply = blob_str(&ans)[0]; |
| 345 | 348 | blob_reset(&ans); |
| 346 | 349 | if( cReply=='a' || cReply=='A' ){ |
| 347 | 350 | forceFlag = 1; |
| 348 | 351 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -417,11 +420,11 @@ | ||
| 417 | 420 | /* |
| 418 | 421 | ** COMMAND: rm |
| 419 | 422 | ** COMMAND: delete |
| 420 | 423 | ** COMMAND: forget* |
| 421 | 424 | ** |
| 422 | -** Usage: %fossil rm|delete|forget FILE1 ?FILE2 ...? | |
| 425 | +** Usage: %fossil rm|delete|forget ?OPTIONS? [--] FILE1 ?FILE2 ...? | |
| 423 | 426 | ** |
| 424 | 427 | ** Remove one or more files or directories from the repository. |
| 425 | 428 | ** |
| 426 | 429 | ** The 'rm' and 'delete' commands do NOT normally remove the files from |
| 427 | 430 | ** disk. They just mark the files as no longer being part of the project. |
| @@ -441,10 +444,12 @@ | ||
| 441 | 444 | ** --soft Skip removing files from the checkout. |
| 442 | 445 | ** This supersedes the --hard option. |
| 443 | 446 | ** --hard Remove files from the checkout. |
| 444 | 447 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 445 | 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. | |
| 446 | 451 | ** |
| 447 | 452 | ** See also: addremove, add |
| 448 | 453 | */ |
| 449 | 454 | void delete_cmd(void){ |
| 450 | 455 | int i; |
| @@ -457,11 +462,11 @@ | ||
| 457 | 462 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 458 | 463 | softFlag = find_option("soft",0,0)!=0; |
| 459 | 464 | hardFlag = find_option("hard",0,0)!=0; |
| 460 | 465 | |
| 461 | 466 | /* We should be done with options.. */ |
| 462 | - verify_all_options(); | |
| 467 | + verify_all_options2(); | |
| 463 | 468 | |
| 464 | 469 | db_must_be_within_tree(); |
| 465 | 470 | db_begin_transaction(); |
| 466 | 471 | if( g.argv[1][0]=='f' ){ /* i.e. "forget" */ |
| 467 | 472 | removeFiles = 0; |
| @@ -823,12 +828,12 @@ | ||
| 823 | 828 | |
| 824 | 829 | /* |
| 825 | 830 | ** COMMAND: mv |
| 826 | 831 | ** COMMAND: rename* |
| 827 | 832 | ** |
| 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 | |
| 830 | 835 | ** |
| 831 | 836 | ** Move or rename one or more files or directories within the repository tree. |
| 832 | 837 | ** You can either rename a file or directory or move it to another subdirectory. |
| 833 | 838 | ** |
| 834 | 839 | ** The 'mv' command does NOT normally rename or move the files on disk. |
| @@ -849,10 +854,12 @@ | ||
| 849 | 854 | ** --soft Skip moving files within the checkout. |
| 850 | 855 | ** This supersedes the --hard option. |
| 851 | 856 | ** --hard Move files within the checkout. |
| 852 | 857 | ** --case-sensitive <BOOL> Override the case-sensitive setting. |
| 853 | 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. | |
| 854 | 861 | ** |
| 855 | 862 | ** See also: changes, status |
| 856 | 863 | */ |
| 857 | 864 | void mv_cmd(void){ |
| 858 | 865 | int i; |
| @@ -871,18 +878,18 @@ | ||
| 871 | 878 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 872 | 879 | softFlag = find_option("soft",0,0)!=0; |
| 873 | 880 | hardFlag = find_option("hard",0,0)!=0; |
| 874 | 881 | |
| 875 | 882 | /* We should be done with options.. */ |
| 876 | - verify_all_options(); | |
| 883 | + verify_all_options2(); | |
| 877 | 884 | |
| 878 | 885 | vid = db_lget_int("checkout", 0); |
| 879 | 886 | if( vid==0 ){ |
| 880 | 887 | fossil_fatal("no checkout in which to rename files"); |
| 881 | 888 | } |
| 882 | 889 | if( g.argc<4 ){ |
| 883 | - usage("OLDNAME NEWNAME"); | |
| 890 | + usage("?OPTIONS? [--] OLDNAME NEWNAME"); | |
| 884 | 891 | } |
| 885 | 892 | zDest = g.argv[g.argc-1]; |
| 886 | 893 | db_begin_transaction(); |
| 887 | 894 | if( g.argv[1][0]=='r' ){ /* i.e. "rename" */ |
| 888 | 895 | moveFiles = 0; |
| @@ -909,11 +916,11 @@ | ||
| 909 | 916 | }else{ |
| 910 | 917 | origType = (file_isdir(g.argv[2], RepoFILE) == 1); |
| 911 | 918 | } |
| 912 | 919 | destType = file_isdir(zDest, RepoFILE); |
| 913 | 920 | if( origType==-1 && destType!=1 ){ |
| 914 | - usage("OLDNAME NEWNAME"); | |
| 921 | + usage("?OPTIONS? [--] OLDNAME NEWNAME"); | |
| 915 | 922 | }else if( origType==1 && destType==2 ){ |
| 916 | 923 | fossil_fatal("cannot rename '%s' to '%s' since another file named" |
| 917 | 924 | " '%s' exists", g.argv[2], zDest, zDest); |
| 918 | 925 | }else if( origType==0 && destType!=1 ){ |
| 919 | 926 | Blob orig; |
| 920 | 927 |
| --- 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 |