##// END OF EJS Templates
merge: split up checks for unknown and ignored files that differ...
Siddharth Agarwal -
r27742:6b639caa default
parent child Browse files
Show More
@@ -990,14 +990,20 b' proxy.'
990
990
991 This section specifies behavior during merges and updates.
991 This section specifies behavior during merges and updates.
992
992
993 ``checkunknown``
993 ``checkignored``
994 Controls behavior when an unknown file on disk has the same name as a tracked
994 Controls behavior when an ignored file on disk has the same name as a tracked
995 file in the changeset being merged or updated to, and has different
995 file in the changeset being merged or updated to, and has different
996 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
996 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
997 abort on such files. With ``warn``, warn on such files and back them up as
997 abort on such files. With ``warn``, warn on such files and back them up as
998 .orig. With ``ignore``, don't print a warning and back them up as
998 .orig. With ``ignore``, don't print a warning and back them up as
999 .orig. (default: ``abort``)
999 .orig. (default: ``abort``)
1000
1000
1001 ``checkunknown``
1002 Controls behavior when an unknown file that isn't ignored has the same name
1003 as a tracked file in the changeset being merged or updated to, and has
1004 different contents. Similar to ``merge.checkignored``, except for files that
1005 are not ignored. (default: ``abort``)
1006
1001 ``merge-patterns``
1007 ``merge-patterns``
1002 ------------------
1008 ------------------
1003
1009
@@ -591,7 +591,8 b' def _checkunknownfiles(repo, wctx, mctx,'
591 elif config == 'warn':
591 elif config == 'warn':
592 warnconflicts.update(conflicts)
592 warnconflicts.update(conflicts)
593
593
594 config = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
594 unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
595 ignoredconfig = _getcheckunknownconfig(repo, 'merge', 'checkignored')
595 for f, (m, args, msg) in actions.iteritems():
596 for f, (m, args, msg) in actions.iteritems():
596 if m in ('c', 'dc'):
597 if m in ('c', 'dc'):
597 if _checkunknownfile(repo, wctx, mctx, f):
598 if _checkunknownfile(repo, wctx, mctx, f):
@@ -600,7 +601,11 b' def _checkunknownfiles(repo, wctx, mctx,'
600 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
601 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
601 conflicts.add(f)
602 conflicts.add(f)
602
603
603 collectconflicts(conflicts, config)
604 ignoredconflicts = set([c for c in conflicts
605 if repo.dirstate._ignore(c)])
606 unknownconflicts = conflicts - ignoredconflicts
607 collectconflicts(ignoredconflicts, ignoredconfig)
608 collectconflicts(unknownconflicts, unknownconfig)
604 for f in sorted(abortconflicts):
609 for f in sorted(abortconflicts):
605 repo.ui.warn(_("%s: untracked file differs\n") % f)
610 repo.ui.warn(_("%s: untracked file differs\n") % f)
606 if abortconflicts:
611 if abortconflicts:
@@ -152,10 +152,78 b' this merge should silently 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
General Comments 0
You need to be logged in to leave comments. Login now