Show More
@@ -99,7 +99,26 b' def _checkunknown(repo, wctx, mctx):' | |||||
99 | raise util.Abort(_("untracked files in working directory differ " |
|
99 | raise util.Abort(_("untracked files in working directory differ " | |
100 | "from files in requested revision")) |
|
100 | "from files in requested revision")) | |
101 |
|
101 | |||
102 | def _checkcollision(mctx, wctx): |
|
102 | def _remains(f, m, ma, workingctx=False): | |
|
103 | """check whether specified file remains after merge. | |||
|
104 | ||||
|
105 | It is assumed that specified file is not contained in the manifest | |||
|
106 | of the other context. | |||
|
107 | """ | |||
|
108 | if f in ma: | |||
|
109 | n = m[f] | |||
|
110 | if n != ma[f]: | |||
|
111 | return True # because it is changed locally | |||
|
112 | # even though it doesn't remain, if "remote deleted" is | |||
|
113 | # chosen in manifestmerge() | |||
|
114 | elif workingctx and n[20:] == "a": | |||
|
115 | return True # because it is added locally (linear merge specific) | |||
|
116 | else: | |||
|
117 | return False # because it is removed remotely | |||
|
118 | else: | |||
|
119 | return True # because it is added locally | |||
|
120 | ||||
|
121 | def _checkcollision(mctx, extractxs): | |||
103 | "check for case folding collisions in the destination context" |
|
122 | "check for case folding collisions in the destination context" | |
104 | folded = {} |
|
123 | folded = {} | |
105 | for fn in mctx: |
|
124 | for fn in mctx: | |
@@ -109,7 +128,8 b' def _checkcollision(mctx, wctx):' | |||||
109 | % (fn, folded[fold])) |
|
128 | % (fn, folded[fold])) | |
110 | folded[fold] = fn |
|
129 | folded[fold] = fn | |
111 |
|
130 | |||
112 |
if |
|
131 | if extractxs: | |
|
132 | wctx, actx = extractxs | |||
113 | # class to delay looking up copy mapping |
|
133 | # class to delay looking up copy mapping | |
114 | class pathcopies(object): |
|
134 | class pathcopies(object): | |
115 | @util.propertycache |
|
135 | @util.propertycache | |
@@ -121,7 +141,9 b' def _checkcollision(mctx, wctx):' | |||||
121 | for fn in wctx: |
|
141 | for fn in wctx: | |
122 | fold = util.normcase(fn) |
|
142 | fold = util.normcase(fn) | |
123 | mfn = folded.get(fold, None) |
|
143 | mfn = folded.get(fold, None) | |
124 |
if mfn and mfn != fn and pc.map.get(mfn) != fn |
|
144 | if (mfn and mfn != fn and pc.map.get(mfn) != fn and | |
|
145 | _remains(fn, wctx.manifest(), actx.manifest(), True) and | |||
|
146 | _remains(mfn, mctx.manifest(), actx.manifest())): | |||
125 | raise util.Abort(_("case-folding collision between %s and %s") |
|
147 | raise util.Abort(_("case-folding collision between %s and %s") | |
126 | % (mfn, fn)) |
|
148 | % (mfn, fn)) | |
127 |
|
149 | |||
@@ -595,7 +617,7 b' def update(repo, node, branchmerge, forc' | |||||
595 | (force or not wc.dirty(missing=True, branch=False))): |
|
617 | (force or not wc.dirty(missing=True, branch=False))): | |
596 | _checkcollision(p2, None) |
|
618 | _checkcollision(p2, None) | |
597 | else: |
|
619 | else: | |
598 | _checkcollision(p2, wc) |
|
620 | _checkcollision(p2, (wc, pa)) | |
599 | if not force: |
|
621 | if not force: | |
600 | _checkunknown(repo, wc, p2) |
|
622 | _checkunknown(repo, wc, p2) | |
601 | action += _forgetremoved(wc, p2, branchmerge) |
|
623 | action += _forgetremoved(wc, p2, branchmerge) |
@@ -11,8 +11,8 b' test for rename awareness of case-foldin' | |||||
11 | (1) colliding file is one renamed from collided file: |
|
11 | (1) colliding file is one renamed from collided file: | |
12 | this is also case for issue3370. |
|
12 | this is also case for issue3370. | |
13 |
|
13 | |||
14 |
$ hg init merge_renam |
|
14 | $ hg init branch_merge_renaming | |
15 |
$ cd merge_renam |
|
15 | $ cd branch_merge_renaming | |
16 |
|
16 | |||
17 | $ echo a > a |
|
17 | $ echo a > a | |
18 | $ hg add a |
|
18 | $ hg add a | |
@@ -53,8 +53,8 b' this is also case for issue3370.' | |||||
53 |
|
53 | |||
54 | (2) colliding file is not related to collided file |
|
54 | (2) colliding file is not related to collided file | |
55 |
|
55 | |||
56 | $ hg init merge_renameaware_2 |
|
56 | $ hg init branch_merge_collding | |
57 | $ cd merge_renameaware_2 |
|
57 | $ cd branch_merge_collding | |
58 |
|
58 | |||
59 | $ echo a > a |
|
59 | $ echo a > a | |
60 | $ hg add a |
|
60 | $ hg add a | |
@@ -66,22 +66,26 b' this is also case for issue3370.' | |||||
66 | $ hg commit -m '#2' |
|
66 | $ hg commit -m '#2' | |
67 | $ hg update --clean 0 |
|
67 | $ hg update --clean 0 | |
68 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
68 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
69 | $ echo 'modified at #3' > a |
|
69 | $ echo x > x | |
|
70 | $ hg add x | |||
70 | $ hg commit -m '#3' |
|
71 | $ hg commit -m '#3' | |
71 | created new head |
|
72 | created new head | |
|
73 | $ echo 'modified at #4' > a | |||
|
74 | $ hg commit -m '#4' | |||
72 |
|
75 | |||
73 | $ hg merge |
|
76 | $ hg merge | |
74 | abort: case-folding collision between A and a |
|
77 | abort: case-folding collision between A and a | |
75 | [255] |
|
78 | [255] | |
76 | $ hg parents --template '{rev}\n' |
|
79 | $ hg parents --template '{rev}\n' | |
77 |
|
|
80 | 4 | |
78 | $ hg status -A |
|
81 | $ hg status -A | |
79 | C a |
|
82 | C a | |
|
83 | C x | |||
80 | $ cat a |
|
84 | $ cat a | |
81 |
modified at # |
|
85 | modified at #4 | |
82 |
|
86 | |||
83 | $ hg update --clean 2 |
|
87 | $ hg update --clean 2 | |
84 |
1 files updated, 0 files merged, |
|
88 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
85 | $ hg merge |
|
89 | $ hg merge | |
86 | abort: case-folding collision between a and A |
|
90 | abort: case-folding collision between a and A | |
87 | [255] |
|
91 | [255] | |
@@ -92,6 +96,29 b' this is also case for issue3370.' | |||||
92 | $ cat A |
|
96 | $ cat A | |
93 | A |
|
97 | A | |
94 |
|
98 | |||
|
99 | test for deletion awareness of case-folding collision check (issue3648): | |||
|
100 | revision '#3' doesn't change 'a', so 'a' should be recognized as | |||
|
101 | safely removed in merging between #2 and #3. | |||
|
102 | ||||
|
103 | $ hg update --clean 3 | |||
|
104 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
105 | $ hg merge 2 | |||
|
106 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
107 | (branch merge, don't forget to commit) | |||
|
108 | $ hg status -A | |||
|
109 | M A | |||
|
110 | R a | |||
|
111 | C x | |||
|
112 | ||||
|
113 | $ hg update --clean 2 | |||
|
114 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
115 | $ hg merge 3 | |||
|
116 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
117 | (branch merge, don't forget to commit) | |||
|
118 | $ hg status -A | |||
|
119 | M x | |||
|
120 | C A | |||
|
121 | ||||
95 | $ cd .. |
|
122 | $ cd .. | |
96 |
|
123 | |||
97 |
|
124 |
General Comments 0
You need to be logged in to leave comments.
Login now