Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix directory naming issue with with the --hard option as reported via the mailing list. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1f694e17046a8c8c7ebbbdebb6b9017b |
User & Date: | mistachkin 2016-03-17 19:30:48.728 |
Context
2016-03-17
| ||
19:32 | Simpler alternative to [7063f8d4cc]. Skips initial directory portion of PATH_INFO when building the g.zBaseURL and g.zTop used with a directory of repositories. ... (check-in: abb19e88 user: mistachkin tags: trunk) | |
19:30 | Fix directory naming issue with with the --hard option as reported via the mailing list. ... (check-in: 1f694e17 user: mistachkin tags: trunk) | |
2016-03-15
| ||
14:04 | Another doc formatting tweak. ... (check-in: ed36875f user: mistachkin tags: trunk) | |
2016-03-12
| ||
00:47 | Update the expected results of the tests to account for trunk changes. ... (Closed-Leaf check-in: b5113985 user: mistachkin tags: mvHardDirFix) | |
Changes
Changes to src/add.c.
︙ | ︙ | |||
783 784 785 786 787 788 789 | Stmt move; if( db_table_exists(db_name("temp"), "fmove") ){ db_prepare(&move, "SELECT x, y FROM fmove ORDER BY x;"); while( db_step(&move)==SQLITE_ROW ){ const char *zOldName = db_column_text(&move, 0); const char *zNewName = db_column_text(&move, 1); if( !dryRunFlag ){ | > > > > > > > | | | | | | > | 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 | Stmt move; if( db_table_exists(db_name("temp"), "fmove") ){ db_prepare(&move, "SELECT x, y FROM fmove ORDER BY x;"); while( db_step(&move)==SQLITE_ROW ){ const char *zOldName = db_column_text(&move, 0); const char *zNewName = db_column_text(&move, 1); if( !dryRunFlag ){ int isOldDir = file_isdir(zOldName); if( isOldDir==1 ){ int isNewDir = file_isdir(zNewName); if( isNewDir==0 ){ file_rename(zOldName, zNewName, isOldDir, isNewDir); } }else{ if( file_wd_islink(zOldName) ){ symlink_copy(zOldName, zNewName); }else{ file_copy(zOldName, zNewName); } file_delete(zOldName); } } fossil_print("MOVED_FILE %s\n", zOldName); } db_finalize(&move); db_multi_exec("DROP TABLE fmove;"); } } |
︙ | ︙ |
Changes to src/file.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** Functions named file_wd_* are to be used for files inside working ** directories. They follow symlinks depending on 'allow-symlinks' setting. */ #include "config.h" #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <errno.h> #include "file.h" /* ** On Windows, include the Platform SDK header file. */ | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ** Functions named file_wd_* are to be used for files inside working ** directories. They follow symlinks depending on 'allow-symlinks' setting. */ #include "config.h" #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "file.h" /* ** On Windows, include the Platform SDK header file. */ |
︙ | ︙ | |||
396 397 398 399 400 401 402 403 404 405 406 407 408 409 | const char *zTail = file_tail(z); if( zTail && zTail!=z ){ return mprintf("%.*s", (int)(zTail-z-1), z); }else{ return 0; } } /* ** Copy the content of a file from one place to another. */ void file_copy(const char *zFrom, const char *zTo){ FILE *in, *out; int got; | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | const char *zTail = file_tail(z); if( zTail && zTail!=z ){ return mprintf("%.*s", (int)(zTail-z-1), z); }else{ return 0; } } /* ** Rename a file or directory. ** Returns zero upon success. */ int file_rename( const char *zFrom, const char *zTo, int isFromDir, int isToDir ){ int rc; #if defined(_WIN32) wchar_t *zMbcsFrom = fossil_utf8_to_path(zFrom, isFromDir); wchar_t *zMbcsTo = fossil_utf8_to_path(zTo, isToDir); rc = _wrename(zMbcsFrom, zMbcsTo); #else char *zMbcsFrom = fossil_utf8_to_path(zFrom, isFromDir); char *zMbcsTo = fossil_utf8_to_path(zTo, isToDir); rc = rename(zMbcsFrom, zMbcsTo); #endif fossil_path_free(zMbcsTo); fossil_path_free(zMbcsFrom); return rc; } /* ** Copy the content of a file from one place to another. */ void file_copy(const char *zFrom, const char *zTo){ FILE *in, *out; int got; |
︙ | ︙ |
Changes to test/mv-rm.test.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 | file mkdir [file join $rootDir subdirB] write_file [file join $rootDir subdirB f9] "f9" file mkdir [file join $rootDir subdirC] write_file [file join $rootDir subdirC f10] "f10" write_file [file join $rootDir subdirC f11] "f11" | > | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | file mkdir [file join $rootDir subdirB] write_file [file join $rootDir subdirB f9] "f9" file mkdir [file join $rootDir subdirC] write_file [file join $rootDir subdirC f10] "f10" write_file [file join $rootDir subdirC f11] "f11" write_file f12 "f12" fossil add f1 f2 f3 f4 f5 f6 f7 f8 subdirB/f9 subdirC/f10 subdirC/f11 f12 fossil commit -m "c1" ######################################## # Test 1: Soft Move Relative Directory # ######################################## file mkdir [file join $rootDir subdir1] |
︙ | ︙ | |||
378 379 380 381 382 383 384 385 386 387 388 389 | } fossil revert test rm-hard-absolute-6 { [normalize_result] eq "REVERT f8${undoMsg}" } cd $rootDir ############################################################################### test_cleanup | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 | } fossil revert test rm-hard-absolute-6 { [normalize_result] eq "REVERT f8${undoMsg}" } cd $rootDir ####################################### # Test 17: Move File to New Directory # ####################################### fossil mv --hard f12 d2/f13 test mv-file-new-directory-1 { [normalize_result] eq "RENAME f12 d2/f13\nMOVED_FILE ${rootDir}/f12" } test mv-file-new-directory-2 {[file size d2/f13] == 3} test mv-file-new-directory-3 {[read_file d2/f13] eq "f12"} fossil revert test mv-file-new-directory-4 { [normalize_result] eq "DELETE d2/f13\nREVERT f12${undoMsg}" } test mv-file-new-directory-5 {[file size f12] == 3} test mv-file-new-directory-6 {[read_file f12] eq "f12"} cd $rootDir ############################################ # Test 18: Move Directory to New Directory # ############################################ fossil mv --hard subdirC subdirD test mv-file-new-directory-7 { [normalize_result] eq "RENAME subdirC subdirD\nMOVED_FILE ${rootDir}/subdirC" } test mv-file-new-directory-8 {[file size subdirD/f10] == 3} test mv-file-new-directory-9 {[read_file subdirD/f10] eq "f10"} test mv-file-new-directory-10 {[file size subdirD/f11] == 3} test mv-file-new-directory-11 {[read_file subdirD/f11] eq "f11"} fossil revert test mv-file-new-directory-12 { [normalize_result] eq "REVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}" } test mv-file-new-directory-13 {[file size subdirC/f10] == 3} test mv-file-new-directory-14 {[read_file subdirC/f10] eq "f10"} test mv-file-new-directory-15 {[file size subdirC/f11] == 3} test mv-file-new-directory-16 {[read_file subdirC/f11] eq "f11"} cd $rootDir ############################################################################### test_cleanup |