##// END OF EJS Templates
icasefs: make case-folding collision detection as rename aware (issue3370)...
FUJIWARA Katsunori -
r16478:cbf2ea2f stable
parent child Browse files
Show More
@@ -110,10 +110,18 b' def _checkcollision(mctx, wctx):'
110 folded[fold] = fn
110 folded[fold] = fn
111
111
112 if wctx:
112 if wctx:
113 # class to delay looking up copy mapping
114 class pathcopies(object):
115 @util.propertycache
116 def map(self):
117 # {dst@mctx: src@wctx} copy mapping
118 return copies.pathcopies(wctx, mctx)
119 pc = pathcopies()
120
113 for fn in wctx:
121 for fn in wctx:
114 fold = util.normcase(fn)
122 fold = util.normcase(fn)
115 mfn = folded.get(fold, None)
123 mfn = folded.get(fold, None)
116 if mfn and (mfn != fn):
124 if mfn and mfn != fn and pc.map.get(mfn) != fn:
117 raise util.Abort(_("case-folding collision between %s and %s")
125 raise util.Abort(_("case-folding collision between %s and %s")
118 % (mfn, fn))
126 % (mfn, fn))
119
127
@@ -568,7 +576,11 b' def update(repo, node, branchmerge, forc'
568 action = []
576 action = []
569 folding = not util.checkcase(repo.path)
577 folding = not util.checkcase(repo.path)
570 if folding:
578 if folding:
571 _checkcollision(p2, branchmerge and p1)
579 # collision check is not needed for clean update
580 if not branchmerge and force:
581 _checkcollision(p2, None)
582 else:
583 _checkcollision(p2, wc)
572 if not force:
584 if not force:
573 _checkunknown(repo, wc, p2)
585 _checkunknown(repo, wc, p2)
574 action += _forgetremoved(wc, p2, branchmerge)
586 action += _forgetremoved(wc, p2, branchmerge)
@@ -6,104 +6,204 b' run only on case-insensitive filesystems'
6 test for branch merging
6 test for branch merging
7 ################################
7 ################################
8
8
9 $ hg init repo1
9 test for rename awareness of case-folding collision check:
10 $ cd repo1
11
12 create base revision
13
10
14 $ echo base > base.txt
11 (1) colliding file is one renamed from collided file:
15 $ hg add base.txt
12 this is also case for issue3370.
16 $ hg commit -m 'base'
17
13
18 add same file in different case on both heads
14 $ hg init merge_renameaware_1
15 $ cd merge_renameaware_1
19
16
20 $ echo a > a.txt
17 $ echo a > a
21 $ hg add a.txt
18 $ hg add a
22 $ hg commit -m 'add a.txt'
19 $ hg commit -m '#0'
23
20 $ hg rename a tmp
21 $ hg rename tmp A
22 $ hg commit -m '#1'
24 $ hg update 0
23 $ hg update 0
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
26
25 $ echo 'modified at #2' > a
27 $ echo A > A.TXT
26 $ hg commit -m '#2'
28 $ hg add A.TXT
29 $ hg commit -m 'add A.TXT'
30 created new head
27 created new head
31
28
32 merge another, and fail with case-folding collision
29 $ hg merge
30 merging a and A to A
31 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
32 (branch merge, don't forget to commit)
33 $ hg status -A
34 M A
35 a
36 R a
37 $ cat A
38 modified at #2
39
40 $ hg update --clean 1
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 $ hg merge
43 merging A and a to A
44 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
45 (branch merge, don't forget to commit)
46 $ hg status -A
47 M A
48 a
49 $ cat A
50 modified at #2
51
52 $ cd ..
53
54 (2) colliding file is not related to collided file
55
56 $ hg init merge_renameaware_2
57 $ cd merge_renameaware_2
58
59 $ echo a > a
60 $ hg add a
61 $ hg commit -m '#0'
62 $ hg remove a
63 $ hg commit -m '#1'
64 $ echo A > A
65 $ hg add A
66 $ hg commit -m '#2'
67 $ hg update --clean 0
68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
69 $ echo 'modified at #3' > a
70 $ hg commit -m '#3'
71 created new head
33
72
34 $ hg merge
73 $ hg merge
35 abort: case-folding collision between a.txt and A.TXT
74 abort: case-folding collision between A and a
36 [255]
75 [255]
76 $ hg parents --template '{rev}\n'
77 3
78 $ hg status -A
79 C a
80 $ cat a
81 modified at #3
37
82
38 check clean-ness of working directory
83 $ hg update --clean 2
39
84 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 $ hg status
85 $ hg merge
86 abort: case-folding collision between a and A
87 [255]
41 $ hg parents --template '{rev}\n'
88 $ hg parents --template '{rev}\n'
42 2
89 2
90 $ hg status -A
91 C A
92 $ cat A
93 A
94
43 $ cd ..
95 $ cd ..
44
96
97
45 ################################
98 ################################
46 test for linear updates
99 test for linear updates
47 ################################
100 ################################
48
101
49 $ hg init repo2
102 test for rename awareness of case-folding collision check:
50 $ cd repo2
51
103
52 create base revision (rev:0)
104 (1) colliding file is one renamed from collided file
105
106 $ hg init linearupdate_renameaware_1
107 $ cd linearupdate_renameaware_1
53
108
54 $ hg import --bypass --exact - <<EOF
109 $ echo a > a
55 > # HG changeset patch
110 $ hg add a
56 > # User null
111 $ hg commit -m '#0'
57 > # Date 1 0
112 $ hg rename a tmp
58 > # Node ID e1bdf414b0ea9c831fd3a14e94a0a18e1410f98b
113 $ hg rename tmp A
59 > # Parent 0000000000000000000000000000000000000000
114 $ hg commit -m '#1'
60 > add a
61 >
62 > diff --git a/a b/a
63 > new file mode 100644
64 > --- /dev/null
65 > +++ b/a
66 > @@ -0,0 +1,3 @@
67 > +this is line 1
68 > +this is line 2
69 > +this is line 3
70 > EOF
71 applying patch from stdin
72
73 create rename revision (rev:1)
74
75 $ hg import --bypass --exact - <<EOF
76 > # HG changeset patch
77 > # User null
78 > # Date 1 0
79 > # Node ID 9dca9f19bb91851bc693544b598b0740629edfad
80 > # Parent e1bdf414b0ea9c831fd3a14e94a0a18e1410f98b
81 > rename a to A
82 >
83 > diff --git a/a b/A
84 > rename from a
85 > rename to A
86 > EOF
87 applying patch from stdin
88
89 update to base revision, and modify 'a'
90
115
91 $ hg update 0
116 $ hg update 0
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
93 $ echo 'this is added line' >> a
94
118
95 update to current tip linearly
119 $ echo 'this is added line' >> a
96
97 $ hg update 1
120 $ hg update 1
98 merging a and A to A
121 merging a and A to A
99 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
122 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
100
101 check status and contents of file
102
103 $ hg status -A
123 $ hg status -A
104 M A
124 M A
105 $ cat A
125 $ cat A
106 this is line 1
126 a
107 this is line 2
108 this is line 3
109 this is added line
127 this is added line
128
129 $ cd ..
130
131 (2) colliding file is not related to collided file
132
133 $ hg init linearupdate_renameaware_2
134 $ cd linearupdate_renameaware_2
135
136 $ echo a > a
137 $ hg add a
138 $ hg commit -m '#0'
139 $ hg remove a
140 $ hg commit -m '#1'
141 $ echo A > A
142 $ hg add A
143 $ hg commit -m '#2'
144
145 $ hg update 0
146 abort: case-folding collision between a and A
147 [255]
148 $ hg parents --template '{rev}\n'
149 2
150 $ hg status -A
151 C A
152 $ cat A
153 A
154
155 $ hg update --check 0
156 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
157 $ hg parents --template '{rev}\n'
158 0
159 $ hg status -A
160 C a
161 $ cat a
162 a
163
164 $ hg update --clean 2
165 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
166 $ hg parents --template '{rev}\n'
167 2
168 $ hg status -A
169 C A
170 $ cat A
171 A
172
173 $ cd ..
174
175 (3) colliding file is not related to collided file: added in working dir
176
177 $ hg init linearupdate_renameaware_3
178 $ cd linearupdate_renameaware_3
179
180 $ echo a > a
181 $ hg add a
182 $ hg commit -m '#0'
183 $ hg rename a b
184 $ hg commit -m '#1'
185 $ hg update 0
186 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
187
188 $ echo B > B
189 $ hg add B
190 $ hg status
191 A B
192 $ hg update
193 abort: case-folding collision between b and B
194 [255]
195
196 $ hg update --check
197 abort: uncommitted local changes
198 [255]
199
200 $ hg update --clean
201 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
202 $ hg parents --template '{rev}\n'
203 1
204 $ hg status -A
205 C b
206 $ cat b
207 a
208
209 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now