Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add '--metadata-only' option to the 'mv' and 'rm' commands. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | mvAndRmFiles |
| Files: | files | file ages | folders |
| SHA1: |
65d5f2756add237613096a82dc07e288 |
| User & Date: | mistachkin 2015-03-04 01:27:32.469 |
Context
|
2015-03-04
| ||
| 02:00 | Recognize the '--soft' and '--hard' options as well for the mv/rm commands. ... (check-in: 2ed14f79d8 user: mistachkin tags: mvAndRmFiles) | |
| 01:27 | Add '--metadata-only' option to the 'mv' and 'rm' commands. ... (check-in: 65d5f2756a user: mistachkin tags: mvAndRmFiles) | |
|
2015-03-03
| ||
| 23:27 | Merge trunk. ... (check-in: ae5c35ef41 user: mistachkin tags: mvAndRmFiles) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
file_delete(zOldName);
}
fossil_print("DELETED_FILE %s\n", zOldName);
}
db_finalize(&remove);
db_multi_exec("DROP TABLE fremove;");
}
/*
** COMMAND: rm
** COMMAND: delete*
**
** Usage: %fossil rm FILE1 ?FILE2 ...?
** or: %fossil delete FILE1 ?FILE2 ...?
**
** Remove one or more files or directories from the repository.
**
** This command does NOT remove the files from disk. It just marks the
** files as no longer being part of the project. In other words, future
** changes to the named files will not be versioned.
**
** Options:
** --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;
int dryRunFlag;
Stmt loop;
dryRunFlag = find_option("dry-run","n",0)!=0;
/* We should be done with options.. */
verify_all_options();
db_must_be_within_tree();
db_begin_transaction();
#if FOSSIL_ENABLE_LEGACY_MV_RM
| > > > > > > > > > > > > > > > > > | | > | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
file_delete(zOldName);
}
fossil_print("DELETED_FILE %s\n", zOldName);
}
db_finalize(&remove);
db_multi_exec("DROP TABLE fremove;");
}
/*
** Capture the command-line --metadata-only option.
*/
static const char *zMetadataOnly = 0;
void capture_metadata_only_option(void){
if( zMetadataOnly==0 ){
zMetadataOnly = find_option("metadata-only",0,1);
}
}
/*
** COMMAND: rm
** COMMAND: delete*
**
** Usage: %fossil rm FILE1 ?FILE2 ...?
** or: %fossil delete FILE1 ?FILE2 ...?
**
** Remove one or more files or directories from the repository.
**
** This command does NOT remove the files from disk. It just marks the
** files as no longer being part of the project. In other words, future
** changes to the named files will not be versioned.
**
** Options:
** --metadata-only <BOOL> Non-zero to skip removing 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;
int dryRunFlag;
Stmt loop;
dryRunFlag = find_option("dry-run","n",0)!=0;
capture_metadata_only_option();
/* We should be done with options.. */
verify_all_options();
db_must_be_within_tree();
db_begin_transaction();
if( zMetadataOnly ){
removeFiles = is_false(zMetadataOnly);
}else{
#if FOSSIL_ENABLE_LEGACY_MV_RM
removeFiles = db_get_boolean("remove-files",0);
#else
removeFiles = FOSSIL_RM_CHECKOUT_FILE_ON_RM;
#endif
}
if( removeFiles ) init_files_to_remove();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)",
filename_collation());
for(i=2; i<g.argc; i++){
Blob treeName;
char *zTreeName;
|
| ︙ | ︙ | |||
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 |
** You can either rename a file or directory or move it to another subdirectory.
**
** This command does NOT rename or move the files on disk. This command merely
** records the fact that filenames have changed so that appropriate notations
** can be made at the next commit/check-in.
**
** Options:
** --case-sensitive <BOOL> Override the case-sensitive setting.
** -n|--dry-run If given, display instead of run actions.
**
** See also: changes, status
*/
void mv_cmd(void){
int i;
int vid;
int moveFiles;
int dryRunFlag;
char *zDest;
Blob dest;
Stmt q;
db_must_be_within_tree();
dryRunFlag = find_option("dry-run","n",0)!=0;
/* We should be done with options.. */
verify_all_options();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("no checkout rename files in");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
}
zDest = g.argv[g.argc-1];
db_begin_transaction();
#if FOSSIL_ENABLE_LEGACY_MV_RM
| > > > > > > > | | > | 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 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
** You can either rename a file or directory or move it to another subdirectory.
**
** This command does NOT rename or move the files on disk. This command merely
** records the fact that filenames have changed so that appropriate notations
** can be made at the next commit/check-in.
**
** Options:
** --metadata-only <BOOL> Non-zero to skip moving files within the
** checkout.
** --case-sensitive <BOOL> Override the case-sensitive setting.
** -n|--dry-run If given, display instead of run actions.
**
** See also: changes, status
*/
void mv_cmd(void){
int i;
int vid;
int moveFiles;
int dryRunFlag;
char *zDest;
Blob dest;
Stmt q;
db_must_be_within_tree();
dryRunFlag = find_option("dry-run","n",0)!=0;
capture_metadata_only_option();
/* We should be done with options.. */
verify_all_options();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("no checkout rename files in");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
}
zDest = g.argv[g.argc-1];
db_begin_transaction();
if( zMetadataOnly ){
moveFiles = is_false(zMetadataOnly);
}else{
#if FOSSIL_ENABLE_LEGACY_MV_RM
moveFiles = db_get_boolean("move-files",0);
#else
moveFiles = FOSSIL_MV_CHECKOUT_FILE_ON_MV;
#endif
}
if( moveFiles ) init_files_to_move();
file_tree_name(zDest, &dest, 1);
db_multi_exec(
"UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
);
db_multi_exec(
"CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
|
| ︙ | ︙ |