Show More
@@ -151,20 +151,23 b' def _checkunknownfiles(repo, wctx, mctx,' | |||||
151 | warnconflicts.update(conflicts) |
|
151 | warnconflicts.update(conflicts) | |
152 |
|
152 | |||
153 | checkunknowndirs = _unknowndirschecker() |
|
153 | checkunknowndirs = _unknowndirschecker() | |
154 |
for f, |
|
154 | for f, args, msg in mresult.getactions( | |
155 |
|
|
155 | [ | |
156 | mergestatemod.ACTION_CREATED, |
|
156 | mergestatemod.ACTION_CREATED, | |
157 | mergestatemod.ACTION_DELETED_CHANGED, |
|
157 | mergestatemod.ACTION_DELETED_CHANGED, | |
158 |
|
|
158 | ] | |
159 | if _checkunknownfile(repo, wctx, mctx, f): |
|
159 | ): | |
160 | fileconflicts.add(f) |
|
160 | if _checkunknownfile(repo, wctx, mctx, f): | |
161 | elif pathconfig and f not in wctx: |
|
161 | fileconflicts.add(f) | |
162 | path = checkunknowndirs(repo, wctx, f) |
|
162 | elif pathconfig and f not in wctx: | |
163 | if path is not None: |
|
163 | path = checkunknowndirs(repo, wctx, f) | |
164 | pathconflicts.add(path) |
|
164 | if path is not None: | |
165 | elif m == mergestatemod.ACTION_LOCAL_DIR_RENAME_GET: |
|
165 | pathconflicts.add(path) | |
166 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): |
|
166 | for f, args, msg in mresult.getactions( | |
167 | fileconflicts.add(f) |
|
167 | [mergestatemod.ACTION_LOCAL_DIR_RENAME_GET] | |
|
168 | ): | |||
|
169 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): | |||
|
170 | fileconflicts.add(f) | |||
168 |
|
171 | |||
169 | allconflicts = fileconflicts | pathconflicts |
|
172 | allconflicts = fileconflicts | pathconflicts | |
170 | ignoredconflicts = {c for c in allconflicts if repo.dirstate._ignore(c)} |
|
173 | ignoredconflicts = {c for c in allconflicts if repo.dirstate._ignore(c)} | |
@@ -172,52 +175,50 b' def _checkunknownfiles(repo, wctx, mctx,' | |||||
172 | collectconflicts(ignoredconflicts, ignoredconfig) |
|
175 | collectconflicts(ignoredconflicts, ignoredconfig) | |
173 | collectconflicts(unknownconflicts, unknownconfig) |
|
176 | collectconflicts(unknownconflicts, unknownconfig) | |
174 | else: |
|
177 | else: | |
175 |
for f, |
|
178 | for f, args, msg in mresult.getactions( | |
176 |
|
|
179 | [mergestatemod.ACTION_CREATED_MERGE] | |
177 | fl2, anc = args |
|
180 | ): | |
178 | different = _checkunknownfile(repo, wctx, mctx, f) |
|
181 | fl2, anc = args | |
179 | if repo.dirstate._ignore(f): |
|
182 | different = _checkunknownfile(repo, wctx, mctx, f) | |
180 | config = ignoredconfig |
|
183 | if repo.dirstate._ignore(f): | |
181 | else: |
|
184 | config = ignoredconfig | |
182 | config = unknownconfig |
|
185 | else: | |
|
186 | config = unknownconfig | |||
183 |
|
187 | |||
184 |
|
|
188 | # The behavior when force is True is described by this table: | |
185 |
|
|
189 | # config different mergeforce | action backup | |
186 |
|
|
190 | # * n * | get n | |
187 |
|
|
191 | # * y y | merge - | |
188 |
|
|
192 | # abort y n | merge - (1) | |
189 |
|
|
193 | # warn y n | warn + get y | |
190 |
|
|
194 | # ignore y n | get y | |
191 |
|
|
195 | # | |
192 |
|
|
196 | # (1) this is probably the wrong behavior here -- we should | |
193 |
|
|
197 | # probably abort, but some actions like rebases currently | |
194 |
|
|
198 | # don't like an abort happening in the middle of | |
195 |
|
|
199 | # merge.update. | |
196 |
|
|
200 | if not different: | |
197 |
|
|
201 | mresult.addfile( | |
198 |
|
|
202 | f, | |
199 |
|
|
203 | mergestatemod.ACTION_GET, | |
200 |
|
|
204 | (fl2, False), | |
201 |
|
|
205 | b'remote created', | |
202 |
|
|
206 | ) | |
203 |
|
|
207 | elif mergeforce or config == b'abort': | |
204 |
|
|
208 | mresult.addfile( | |
205 |
|
|
209 | f, | |
206 |
|
|
210 | mergestatemod.ACTION_MERGE, | |
207 |
|
|
211 | (f, f, None, False, anc), | |
208 |
|
|
212 | b'remote differs from untracked local', | |
209 |
|
|
213 | ) | |
210 |
|
|
214 | elif config == b'abort': | |
211 |
|
|
215 | abortconflicts.add(f) | |
212 |
|
|
216 | else: | |
213 |
|
|
217 | if config == b'warn': | |
214 |
|
|
218 | warnconflicts.add(f) | |
215 |
|
|
219 | mresult.addfile( | |
216 | f, |
|
220 | f, mergestatemod.ACTION_GET, (fl2, True), b'remote created', | |
217 | mergestatemod.ACTION_GET, |
|
221 | ) | |
218 | (fl2, True), |
|
|||
219 | b'remote created', |
|
|||
220 | ) |
|
|||
221 |
|
222 | |||
222 | for f in sorted(abortconflicts): |
|
223 | for f in sorted(abortconflicts): | |
223 | warn = repo.ui.warn |
|
224 | warn = repo.ui.warn | |
@@ -242,15 +243,14 b' def _checkunknownfiles(repo, wctx, mctx,' | |||||
242 | else: |
|
243 | else: | |
243 | repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f) |
|
244 | repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f) | |
244 |
|
245 | |||
245 | for f, (m, args, msg) in pycompat.iteritems(mresult.actions): |
|
246 | for f, args, msg in mresult.getactions([mergestatemod.ACTION_CREATED]): | |
246 | if m == mergestatemod.ACTION_CREATED: |
|
247 | backup = ( | |
247 | backup = ( |
|
248 | f in fileconflicts | |
248 |
|
|
249 | or f in pathconflicts | |
249 |
|
|
250 | or any(p in pathconflicts for p in pathutil.finddirs(f)) | |
250 | or any(p in pathconflicts for p in pathutil.finddirs(f)) |
|
251 | ) | |
251 | ) |
|
252 | (flags,) = args | |
252 | (flags,) = args |
|
253 | mresult.addfile(f, mergestatemod.ACTION_GET, (flags, backup), msg) | |
253 | mresult.addfile(f, mergestatemod.ACTION_GET, (flags, backup), msg) |
|
|||
254 |
|
254 | |||
255 |
|
255 | |||
256 | def _forgetremoved(wctx, mctx, branchmerge): |
|
256 | def _forgetremoved(wctx, mctx, branchmerge): | |
@@ -650,13 +650,17 b' class mergeresult(object):' | |||||
650 | def hasconflicts(self): |
|
650 | def hasconflicts(self): | |
651 | """ tells whether this merge resulted in some actions which can |
|
651 | """ tells whether this merge resulted in some actions which can | |
652 | result in conflicts or not """ |
|
652 | result in conflicts or not """ | |
653 | for _f, (m, _unused, _unused) in pycompat.iteritems(self._filemapping): |
|
653 | for a in self._actionmapping.keys(): | |
654 |
if |
|
654 | if ( | |
655 | mergestatemod.ACTION_GET, |
|
655 | a | |
656 | mergestatemod.ACTION_KEEP, |
|
656 | not in ( | |
657 |
mergestatemod.ACTION_ |
|
657 | mergestatemod.ACTION_GET, | |
658 |
mergestatemod.ACTION_ |
|
658 | mergestatemod.ACTION_KEEP, | |
659 |
mergestatemod.ACTION_ |
|
659 | mergestatemod.ACTION_EXEC, | |
|
660 | mergestatemod.ACTION_REMOVE, | |||
|
661 | mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, | |||
|
662 | ) | |||
|
663 | and self._actionmapping[a] | |||
660 | ): |
|
664 | ): | |
661 | return True |
|
665 | return True | |
662 |
|
666 | |||
@@ -992,21 +996,19 b' def _resolvetrivial(repo, wctx, mctx, an' | |||||
992 | remained the same.""" |
|
996 | remained the same.""" | |
993 | # We force a copy of actions.items() because we're going to mutate |
|
997 | # We force a copy of actions.items() because we're going to mutate | |
994 | # actions as we resolve trivial conflicts. |
|
998 | # actions as we resolve trivial conflicts. | |
995 |
for f, |
|
999 | for f, args, msg in mresult.getactions( | |
996 | if ( |
|
1000 | [mergestatemod.ACTION_CHANGED_DELETED] | |
997 | m == mergestatemod.ACTION_CHANGED_DELETED |
|
1001 | ): | |
998 | and f in ancestor |
|
1002 | if f in ancestor and not wctx[f].cmp(ancestor[f]): | |
999 | and not wctx[f].cmp(ancestor[f]) |
|
|||
1000 | ): |
|
|||
1001 | # local did change but ended up with same content |
|
1003 | # local did change but ended up with same content | |
1002 | mresult.addfile( |
|
1004 | mresult.addfile( | |
1003 | f, mergestatemod.ACTION_REMOVE, None, b'prompt same' |
|
1005 | f, mergestatemod.ACTION_REMOVE, None, b'prompt same' | |
1004 | ) |
|
1006 | ) | |
1005 | elif ( |
|
1007 | ||
1006 | m == mergestatemod.ACTION_DELETED_CHANGED |
|
1008 | for f, args, msg in list( | |
1007 | and f in ancestor |
|
1009 | mresult.getactions([mergestatemod.ACTION_DELETED_CHANGED]) | |
1008 | and not mctx[f].cmp(ancestor[f]) |
|
1010 | ): | |
1009 | ): |
|
1011 | if f in ancestor and not mctx[f].cmp(ancestor[f]): | |
1010 | # remote did change but ended up with same content |
|
1012 | # remote did change but ended up with same content | |
1011 | mresult.removefile(f) # don't get = keep local deleted |
|
1013 | mresult.removefile(f) # don't get = keep local deleted | |
1012 |
|
1014 |
General Comments 0
You need to be logged in to leave comments.
Login now