Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch unaddremove-command Excluding Merge-Ins
This is equivalent to a diff from 87e3ad31 to 58ee0645
2020-05-28
| ||
08:48 | Add --reset flag to add/rm/addremove commands. (check-in: e0fc98ca user: stephan tags: trunk) | |
2020-05-26
| ||
15:54 | Attempt to fix markdown rendering so that it correctly ignores table column separators that are contained without "code-span" back-ticks. (check-in: d6058989 user: drh tags: trunk) | |
07:16 | Merged in trunk. (Closed-Leaf check-in: 58ee0645 user: stephan tags: unaddremove-command) | |
06:56 | merged in trunk (Closed-Leaf check-in: a2b0ed37 user: stephan tags: forum-edit-deltify) | |
06:47 | merged in trunk. (Closed-Leaf check-in: fe018289 user: stephan tags: style-css-revamp) | |
06:43 | Merged in trunk. (check-in: 559807ba user: stephan tags: fileedit-ajaxify) | |
2020-05-25
| ||
23:40 | Update the changes log to include a date for 2.11 and to add a place-holder to begin recording 2.12 changes. (check-in: 87e3ad31 user: drh tags: trunk) | |
23:23 | Version 2.11 (check-in: 4df91980 user: drh tags: trunk, release, version-2.11) | |
2020-05-12
| ||
08:48 | Merged in trunk. Minor help text corrections for add/rm --reset. (check-in: 822f3aee user: stephan tags: unaddremove-command) | |
Changes to src/add.c.
︙ | ︙ | |||
238 239 240 241 242 243 244 245 246 247 248 249 250 251 | if( zReserved ) continue; nAdd += add_one_file(zToAdd, vid); } db_finalize(&loop); blob_reset(&repoName); return nAdd; } /* ** COMMAND: add ** ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? ** ** Make arrangements to add one or more files or directories to the | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 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 | if( zReserved ) continue; nAdd += add_one_file(zToAdd, vid); } db_finalize(&loop); blob_reset(&repoName); return nAdd; } /* ** Resets the ADDED/DELETED state of a checkout, such that all ** newly-added (but not yet committed) files are no longer added and ** newly-removed (but not yet committed) files are no longer ** removed. If bIsAdd is true, it operates on the "add" state, else it ** operates on the "rm" state. ** ** If bDryRun is true it outputs what it would have done, but does not ** actually do it. In this case it rolls back the transaction it ** starts (so don't start a transaction before calling this). ** ** If bVerbose is true it outputs the name of each reset entry. ** ** This is intended to be called only in the context of the ** add/rm/addremove commands, after a call to verify_all_options(). ** ** Un-added files are not modified but any un-rm'd files which are ** missing from the checkout are restored from the repo. un-rm'd files ** which exist in the checkout are left as-is, rather than restoring ** them using vfile_to_disk(), to avoid overwriting any local changes ** made to those files. */ static void addremove_reset(int bIsAdd, int bDryRun, int bVerbose){ int nReset = 0; /* # of entries which get reset */ Stmt stmt; /* vfile loop query */ db_begin_transaction(); db_prepare(&stmt, "SELECT id, pathname FROM vfile " "WHERE %s ORDER BY pathname", bIsAdd==0 ? "deleted<>0" : "rid=0"/*safe-for-%s*/); while( db_step(&stmt)==SQLITE_ROW ){ /* This loop exists only so we can restore the contents of un-rm'd ** files and support verbose mode. All manipulation of vfile's ** contents happens after the loop. For the ADD case in non-verbose ** mode we "could" skip this loop entirely. */ int const id = db_column_int(&stmt, 0); char const * zPathname = db_column_text(&stmt, 1); Blob relName = empty_blob; if(bIsAdd==0 || bVerbose!=0){ /* Make filename relative... */ char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); file_relative_name(zFullName, &relName, 0); fossil_free(zFullName); } if(bIsAdd==0){ /* Restore contents of missing un-rm'd files. We don't do this ** unconditionally because we might cause data loss if a file ** is modified, rm'd, then un-rm'd. */ ++nReset; if(!file_isfile_or_link(blob_str(&relName))){ if(bDryRun==0){ vfile_to_disk(0, id, 0, 0); if(bVerbose){ fossil_print("Restored missing file: %b\n", &relName); } }else{ fossil_print("Dry-run: not restoring missing file: %b\n", &relName); } } if(bVerbose){ fossil_print("Un-removed: %b\n", &relName); } }else{ /* un-add... */ ++nReset; if(bVerbose){ fossil_print("Un-added: %b\n", &relName); } } blob_reset(&relName); } db_finalize(&stmt); if(nReset>0){ if(bIsAdd==0){ if(bDryRun==0){ db_exec_sql("UPDATE vfile SET deleted=0 WHERE deleted<>0"); } fossil_print("Un-removed %d file(s).\n", nReset); }else{ if(bDryRun==0){ db_exec_sql("DELETE FROM vfile WHERE rid=0"); } fossil_print("Un-added %d file(s).\n", nReset); } } db_end_transaction(bDryRun ? 1 : 0); } /* ** COMMAND: add ** ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? ** ** Make arrangements to add one or more files or directories to the |
︙ | ︙ | |||
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 | ** --case-sensitive <BOOL> Override the case-sensitive setting. ** --dotfiles include files beginning with a dot (".") ** -f|--force Add files without prompting ** --ignore <CSG> Ignore unmanaged files matching patterns from ** the comma separated list of glob patterns. ** --clean <CSG> Also ignore files matching patterns from ** the comma separated list of glob patterns. ** ** See also: addremove, rm */ void add_cmd(void){ int i; /* Loop counter */ int vid; /* Currently checked out version */ int nRoot; /* Full path characters in g.zLocalRoot */ const char *zCleanFlag; /* The --clean option or clean-glob setting */ const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ int forceFlag; zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); forceFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; /* We should be done with options.. */ | > > > > > > > > > > > > > > > > > > | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 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 | ** --case-sensitive <BOOL> Override the case-sensitive setting. ** --dotfiles include files beginning with a dot (".") ** -f|--force Add files without prompting ** --ignore <CSG> Ignore unmanaged files matching patterns from ** the comma separated list of glob patterns. ** --clean <CSG> Also ignore files matching patterns from ** the comma separated list of glob patterns. ** --reset Reset the ADDEd state of a checkout, such ** that all newly-added (but not yet committed) ** files are no longer added. No flags other ** than --verbose and --dry-run may be used ** with --reset. ** ** The following options are only valid with --reset: ** -v|--verbose Outputs information about each --reset file. ** -n|--dry-run Display instead of run actions. ** ** See also: addremove, rm */ void add_cmd(void){ int i; /* Loop counter */ int vid; /* Currently checked out version */ int nRoot; /* Full path characters in g.zLocalRoot */ const char *zCleanFlag; /* The --clean option or clean-glob setting */ const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ int forceFlag; if(0!=find_option("reset",0,0)){ int const verboseFlag = find_option("verbose","v",0)!=0; int const dryRunFlag = find_option("dry-run","n",0)!=0; db_must_be_within_tree(); verify_all_options(); addremove_reset(1, dryRunFlag, verboseFlag); return; } zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); forceFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; /* We should be done with options.. */ |
︙ | ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 451 452 | ** ** Options: ** --soft Skip removing files from the checkout. ** This supersedes the --hard option. ** --hard Remove files from the checkout. ** --case-sensitive <BOOL> Override the case-sensitive setting. ** -n|--dry-run If given, display instead of run actions. ** ** See also: addremove, add */ void delete_cmd(void){ int i; int removeFiles; | > > > > > > > | > | > > > > > > | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | ** ** Options: ** --soft Skip removing files from the checkout. ** This supersedes the --hard option. ** --hard Remove files from the checkout. ** --case-sensitive <BOOL> Override the case-sensitive setting. ** -n|--dry-run If given, display instead of run actions. ** --reset Reset the DELETED state of a checkout, such ** that all newly-rm'd (but not yet committed) ** files are no longer removed. No flags other ** than --verbose or --dry-run may be used with ** --reset. ** --verbose|-v Outputs information about each --reset file. ** Only usable with --reset. ** ** See also: addremove, add */ void delete_cmd(void){ int i; int removeFiles; int dryRunFlag = find_option("dry-run","n",0)!=0; int softFlag; int hardFlag; Stmt loop; if(0!=find_option("reset",0,0)){ int const verboseFlag = find_option("verbose","v",0)!=0; db_must_be_within_tree(); verify_all_options(); addremove_reset(0, dryRunFlag, verboseFlag); return; } softFlag = find_option("soft",0,0)!=0; hardFlag = find_option("hard",0,0)!=0; /* We should be done with options.. */ verify_all_options(); db_must_be_within_tree(); |
︙ | ︙ | |||
621 622 623 624 625 626 627 628 629 630 631 632 | ** --case-sensitive <BOOL> Override the case-sensitive setting. ** --dotfiles Include files beginning with a dot (".") ** --ignore <CSG> Ignore unmanaged files matching patterns from ** the comma separated list of glob patterns. ** --clean <CSG> Also ignore files matching patterns from ** the comma separated list of glob patterns. ** -n|--dry-run If given, display instead of run actions. ** ** See also: add, rm */ void addremove_cmd(void){ Blob path; | > > > > > > > > | | | > > > > > > > > > > > > > | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | ** --case-sensitive <BOOL> Override the case-sensitive setting. ** --dotfiles Include files beginning with a dot (".") ** --ignore <CSG> Ignore unmanaged files matching patterns from ** the comma separated list of glob patterns. ** --clean <CSG> Also ignore files matching patterns from ** the comma separated list of glob patterns. ** -n|--dry-run If given, display instead of run actions. ** --reset Reset the ADDED/DELETED state of a checkout, ** such that all newly-added (but not yet committed) ** files are no longer added and all newly-removed ** (but not yet committed) files are no longer ** removed. No flags other than --verbose and ** --dry-run may be used with --reset. ** --verbose|-v Outputs information about each --reset file. ** Only usable with --reset. ** ** See also: add, rm */ void addremove_cmd(void){ Blob path; const char *zCleanFlag; const char *zIgnoreFlag; unsigned scanFlags; int dryRunFlag = find_option("dry-run","n",0)!=0; int n; Stmt q; int vid; int nAdd = 0; int nDelete = 0; Glob *pIgnore, *pClean; if( !dryRunFlag ){ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ } if(0!=find_option("reset",0,0)){ int const verboseFlag = find_option("verbose","v",0)!=0; db_must_be_within_tree(); verify_all_options(); addremove_reset(0, dryRunFlag, verboseFlag); addremove_reset(1, dryRunFlag, verboseFlag); return; } zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; /* We should be done with options.. */ verify_all_options(); /* Fail if unprocessed arguments are present, in case user expect the ** addremove command to accept a list of file or directory. */ if( g.argc>2 ){ |
︙ | ︙ | |||
708 709 710 711 712 713 714 | } db_finalize(&q); /* show command summary */ fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); db_end_transaction(dryRunFlag); } | < | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | } db_finalize(&q); /* show command summary */ fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); db_end_transaction(dryRunFlag); } /* ** Rename a single file. ** ** The original name of the file is zOrig. The new filename is zNew. */ static void mv_one_file( |
︙ | ︙ |