| 1 |
Test update logic when there are renames or weird same-name cases between dirs |
| 2 |
and files |
| 3 |
|
| 4 |
Update with local changes across a file rename |
| 5 |
|
| 6 |
$ hg init r1 && cd r1 |
| 7 |
|
| 8 |
$ echo a > a |
| 9 |
$ hg add a |
| 10 |
$ hg ci -m a |
| 11 |
|
| 12 |
$ hg mv a b |
| 13 |
$ hg ci -m rename |
| 14 |
|
| 15 |
$ echo b > b |
| 16 |
$ hg ci -m change |
| 17 |
|
| 18 |
$ hg up -q 0 |
| 19 |
|
| 20 |
$ echo c > a |
| 21 |
|
| 22 |
$ hg up |
| 23 |
merging a and b to b |
| 24 |
warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
| 25 |
0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
| 26 |
use 'hg resolve' to retry unresolved file merges |
| 27 |
[1] |
| 28 |
|
| 29 |
Test update when local untracked directory exists with the same name as a |
| 30 |
tracked file in a commit we are updating to |
| 31 |
$ hg init r2 && cd r2 |
| 32 |
$ echo root > root && hg ci -Am root # rev 0 |
| 33 |
adding root |
| 34 |
$ echo text > name && hg ci -Am "name is a file" # rev 1 |
| 35 |
adding name |
| 36 |
$ hg up 0 |
| 37 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 38 |
$ mkdir name |
| 39 |
$ hg up 1 |
| 40 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 41 |
|
| 42 |
Test update when local untracked directory exists with some files in it and has |
| 43 |
the same name a tracked file in a commit we are updating to. In future this |
| 44 |
should be updated to give an friendlier error message, but now we should just |
| 45 |
make sure that this does not erase untracked data |
| 46 |
$ hg up 0 |
| 47 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 48 |
$ mkdir name |
| 49 |
$ echo text > name/file |
| 50 |
$ hg st |
| 51 |
? name/file |
| 52 |
$ hg up 1 |
| 53 |
abort: Unlinking directory not permitted: *$TESTTMP/r1/r2/name* (glob) (windows !) |
| 54 |
abort: Directory not empty: '?\$TESTTMP/r1/r2/name'? (re) (no-windows no-rust !) |
| 55 |
abort: conflicting unknown directory '$TESTTMP/r1/r2/name' is not empty (no-windows rust !) |
| 56 |
[255] |
| 57 |
$ cat name/file |
| 58 |
text |
| 59 |
$ cd .. |
| 60 |
|
| 61 |
#if symlink |
| 62 |
|
| 63 |
Test update when two commits have symlinks that point to different folders |
| 64 |
$ hg init r3 && cd r3 |
| 65 |
$ echo root > root && hg ci -Am root |
| 66 |
adding root |
| 67 |
$ mkdir folder1 && mkdir folder2 |
| 68 |
$ ln -s folder1 folder |
| 69 |
$ hg ci -Am "symlink to folder1" |
| 70 |
adding folder |
| 71 |
$ rm folder |
| 72 |
$ ln -s folder2 folder |
| 73 |
$ hg ci -Am "symlink to folder2" |
| 74 |
$ hg up 1 |
| 75 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 76 |
$ cd .. |
| 77 |
|
| 78 |
#endif |
| 79 |
|
| 80 |
#if rmcwd |
| 81 |
|
| 82 |
Test that warning is printed if cwd is deleted during update |
| 83 |
$ hg init r4 && cd r4 |
| 84 |
$ mkdir dir |
| 85 |
$ cd dir |
| 86 |
$ echo a > a |
| 87 |
$ echo b > b |
| 88 |
$ hg add a b |
| 89 |
$ hg ci -m "file and dir" |
| 90 |
$ hg up -q null |
| 91 |
current directory was removed |
| 92 |
(consider changing to repo root: $TESTTMP/r1/r4) |
| 93 |
|
| 94 |
#endif |