comparison tests/test-issue660 @ 5483:0c43f87baba3 default tip

Fix file-changed-to-dir and dir-to-file commits (issue660). Allow adding to dirstate files that clash with previously existing but marked for removal. Protect from reintroducing clashes by revert. This change doesn't address related issues with update. Current workaround is to do "clean" update by manually removing conflicting files/dirs from working directory.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Oct 2007 16:27:55 +0400
parents
children
comparison
equal deleted inserted replaced
5482:7ceb740f2fef 5483:0c43f87baba3
1 #!/bin/sh
2 # http://www.selenic.com/mercurial/bts/issue660
3
4
5 hg init a
6 cd a
7 echo a > a
8 mkdir b
9 echo b > b/b
10 hg commit -A -m "a is file, b is dir"
11
12 echo % file replaced with directory
13
14 rm a
15 mkdir a
16 echo a > a/a
17
18 echo % should fail - would corrupt dirstate
19 hg add a/a
20
21 echo % removing shadow
22 hg rm --after a
23
24 echo % should succeed - shadow removed
25 hg add a/a
26
27 echo % directory replaced with file
28
29 rm -r b
30 echo b > b
31
32 echo % should fail - would corrupt dirstate
33 hg add b
34
35 echo % removing shadow
36 hg rm --after b/b
37
38 echo % should succeed - shadow removed
39 hg add b
40
41 echo % look what we got
42 hg st
43
44 echo % revert reintroducing shadow - should fail
45 rm -r a b
46 hg revert b/b
47
48 echo % revert all - should succeed
49 hg revert --all
50 hg st
51
52 echo % addremove
53
54 rm -r a b
55 mkdir a
56 echo a > a/a
57 echo b > b
58
59 hg addremove
60 hg st
61
62 echo % commit
63 hg ci -A -m "a is dir, b is file"
64 hg st --all
65
66 echo % long directory replaced with file
67
68 mkdir d
69 mkdir d/d
70 echo d > d/d/d
71 hg commit -A -m "d is long directory"
72 rm -r d
73 echo d > d
74
75 echo % should fail - would corrupt dirstate
76 hg add d
77
78 echo % removing shadow
79 hg rm --after d/d/d
80
81 echo % should succeed - shadow removed
82 hg add d
83
84 #echo % update should work
85 #
86 #hg up -r 0
87 #hg up -r 1
88
89 exit 0