Mercurial > hg
comparison tests/test-merge1.t @ 27742:6b639caa1652
merge: split up checks for unknown and ignored files that differ
In some real-world cases it is preferable to allow overwriting ignored files
while continuing to abort on unknown files. This primarily happens when we're
replacing build artifacts (which are ignored) with checked in files, but
continuing to abort on differing files that aren't ignored.
We're redefining merge.checkunknown to only control the behavior for files
that aren't ignored. That's fine because this config was only very recently
introduced and has not made its way into any Mercurial releases yet.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 12 Jan 2016 18:38:49 -0800 |
parents | 7b5c8c8a2f8c |
children | 1e4512eac59e |
comparison
equal
deleted
inserted
replaced
27741:3951f132958f | 27742:6b639caa1652 |
---|---|
150 This is file b2 | 150 This is file b2 |
151 $ hg merge 1 --config merge.checkunknown=ignore | 151 $ hg merge 1 --config merge.checkunknown=ignore |
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
153 (branch merge, don't forget to commit) | 153 (branch merge, don't forget to commit) |
154 | 154 |
155 merge.checkignored | |
156 $ hg up --clean 1 | |
157 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
158 $ cat >> .hgignore << EOF | |
159 > remoteignored | |
160 > EOF | |
161 $ echo This is file localignored3 > localignored | |
162 $ echo This is file remoteignored3 > remoteignored | |
163 $ hg add .hgignore localignored remoteignored | |
164 $ hg commit -m "commit #3" | |
165 | |
166 $ hg up 2 | |
167 1 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
168 $ cat >> .hgignore << EOF | |
169 > localignored | |
170 > EOF | |
171 $ hg add .hgignore | |
172 $ hg commit -m "commit #4" | |
173 | |
174 remote .hgignore shouldn't be used for determining whether a file is ignored | |
175 $ echo This is file remoteignored4 > remoteignored | |
176 $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort | |
177 remoteignored: untracked file differs | |
178 abort: untracked files in working directory differ from files in requested revision | |
179 [255] | |
180 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore | |
181 merging .hgignore | |
182 merging for .hgignore | |
183 3 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
184 (branch merge, don't forget to commit) | |
185 $ cat remoteignored | |
186 This is file remoteignored3 | |
187 $ cat remoteignored.orig | |
188 This is file remoteignored4 | |
189 $ rm remoteignored.orig | |
190 | |
191 local .hgignore should be used for that | |
192 $ hg up --clean 4 | |
193 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
194 $ echo This is file localignored4 > localignored | |
195 also test other conflicting files to see we output the full set of warnings | |
196 $ echo This is file b2 > b | |
197 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort | |
198 b: untracked file differs | |
199 localignored: untracked file differs | |
200 abort: untracked files in working directory differ from files in requested revision | |
201 [255] | |
202 $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore | |
203 localignored: untracked file differs | |
204 abort: untracked files in working directory differ from files in requested revision | |
205 [255] | |
206 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort | |
207 b: untracked file differs | |
208 abort: untracked files in working directory differ from files in requested revision | |
209 [255] | |
210 $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn | |
211 b: replacing untracked file | |
212 localignored: replacing untracked file | |
213 merging .hgignore | |
214 merging for .hgignore | |
215 3 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
216 (branch merge, don't forget to commit) | |
217 $ cat localignored | |
218 This is file localignored3 | |
219 $ cat localignored.orig | |
220 This is file localignored4 | |
221 $ rm localignored.orig | |
222 | |
155 $ cat b.orig | 223 $ cat b.orig |
156 This is file b2 | 224 This is file b2 |
157 $ hg up --clean 2 | 225 $ hg up --clean 2 |
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | 226 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
159 $ mv b.orig b | 227 $ mv b.orig b |
160 | 228 |
161 this merge of b should work | 229 this merge of b should work |
162 $ cat b | 230 $ cat b |
163 This is file b2 | 231 This is file b2 |