##// END OF EJS Templates
merge: pass mergeresult instead of actions in _checkunknownfiles() (API)...
Pulkit Goyal -
r45844:4ad6c4e9 default
parent child Browse files
Show More
@@ -492,11 +492,11 b' def applyupdates('
492
492
493
493
494 # Prefetch merge checkunknownfiles
494 # Prefetch merge checkunknownfiles
495 def checkunknownfiles(orig, repo, wctx, mctx, force, actions, *args, **kwargs):
495 def checkunknownfiles(orig, repo, wctx, mctx, force, mresult, *args, **kwargs):
496 if isenabled(repo):
496 if isenabled(repo):
497 files = []
497 files = []
498 sparsematch = repo.maybesparsematch(mctx.rev())
498 sparsematch = repo.maybesparsematch(mctx.rev())
499 for f, (m, actionargs, msg) in pycompat.iteritems(actions):
499 for f, (m, actionargs, msg) in pycompat.iteritems(mresult.actions):
500 if sparsematch and not sparsematch(f):
500 if sparsematch and not sparsematch(f):
501 continue
501 continue
502 if m in (b'c', b'dc', b'cm'):
502 if m in (b'c', b'dc', b'cm'):
@@ -506,7 +506,7 b' def checkunknownfiles(orig, repo, wctx, '
506 files.append((f2, hex(mctx.filenode(f2))))
506 files.append((f2, hex(mctx.filenode(f2))))
507 # batch fetch the needed files from the server
507 # batch fetch the needed files from the server
508 repo.fileservice.prefetch(files)
508 repo.fileservice.prefetch(files)
509 return orig(repo, wctx, mctx, force, actions, *args, **kwargs)
509 return orig(repo, wctx, mctx, force, mresult, *args, **kwargs)
510
510
511
511
512 # Prefetch files before status attempts to look at their size and contents
512 # Prefetch files before status attempts to look at their size and contents
@@ -126,7 +126,7 b' class _unknowndirschecker(object):'
126 return None
126 return None
127
127
128
128
129 def _checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce):
129 def _checkunknownfiles(repo, wctx, mctx, force, mresult, mergeforce):
130 """
130 """
131 Considers any actions that care about the presence of conflicting unknown
131 Considers any actions that care about the presence of conflicting unknown
132 files. For some actions, the result is to abort; for others, it is to
132 files. For some actions, the result is to abort; for others, it is to
@@ -150,7 +150,7 b' def _checkunknownfiles(repo, wctx, mctx,'
150 warnconflicts.update(conflicts)
150 warnconflicts.update(conflicts)
151
151
152 checkunknowndirs = _unknowndirschecker()
152 checkunknowndirs = _unknowndirschecker()
153 for f, (m, args, msg) in pycompat.iteritems(actions):
153 for f, (m, args, msg) in pycompat.iteritems(mresult.actions):
154 if m in (
154 if m in (
155 mergestatemod.ACTION_CREATED,
155 mergestatemod.ACTION_CREATED,
156 mergestatemod.ACTION_DELETED_CHANGED,
156 mergestatemod.ACTION_DELETED_CHANGED,
@@ -171,7 +171,7 b' def _checkunknownfiles(repo, wctx, mctx,'
171 collectconflicts(ignoredconflicts, ignoredconfig)
171 collectconflicts(ignoredconflicts, ignoredconfig)
172 collectconflicts(unknownconflicts, unknownconfig)
172 collectconflicts(unknownconflicts, unknownconfig)
173 else:
173 else:
174 for f, (m, args, msg) in pycompat.iteritems(actions):
174 for f, (m, args, msg) in pycompat.iteritems(mresult.actions):
175 if m == mergestatemod.ACTION_CREATED_MERGE:
175 if m == mergestatemod.ACTION_CREATED_MERGE:
176 fl2, anc = args
176 fl2, anc = args
177 different = _checkunknownfile(repo, wctx, mctx, f)
177 different = _checkunknownfile(repo, wctx, mctx, f)
@@ -193,13 +193,15 b' def _checkunknownfiles(repo, wctx, mctx,'
193 # don't like an abort happening in the middle of
193 # don't like an abort happening in the middle of
194 # merge.update.
194 # merge.update.
195 if not different:
195 if not different:
196 actions[f] = (
196 mresult.addfile(
197 f,
197 mergestatemod.ACTION_GET,
198 mergestatemod.ACTION_GET,
198 (fl2, False),
199 (fl2, False),
199 b'remote created',
200 b'remote created',
200 )
201 )
201 elif mergeforce or config == b'abort':
202 elif mergeforce or config == b'abort':
202 actions[f] = (
203 mresult.addfile(
204 f,
203 mergestatemod.ACTION_MERGE,
205 mergestatemod.ACTION_MERGE,
204 (f, f, None, False, anc),
206 (f, f, None, False, anc),
205 b'remote differs from untracked local',
207 b'remote differs from untracked local',
@@ -209,7 +211,8 b' def _checkunknownfiles(repo, wctx, mctx,'
209 else:
211 else:
210 if config == b'warn':
212 if config == b'warn':
211 warnconflicts.add(f)
213 warnconflicts.add(f)
212 actions[f] = (
214 mresult.addfile(
215 f,
213 mergestatemod.ACTION_GET,
216 mergestatemod.ACTION_GET,
214 (fl2, True),
217 (fl2, True),
215 b'remote created',
218 b'remote created',
@@ -238,7 +241,7 b' def _checkunknownfiles(repo, wctx, mctx,'
238 else:
241 else:
239 repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f)
242 repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f)
240
243
241 for f, (m, args, msg) in pycompat.iteritems(actions):
244 for f, (m, args, msg) in pycompat.iteritems(mresult.actions):
242 if m == mergestatemod.ACTION_CREATED:
245 if m == mergestatemod.ACTION_CREATED:
243 backup = (
246 backup = (
244 f in fileconflicts
247 f in fileconflicts
@@ -246,7 +249,7 b' def _checkunknownfiles(repo, wctx, mctx,'
246 or any(p in pathconflicts for p in pathutil.finddirs(f))
249 or any(p in pathconflicts for p in pathutil.finddirs(f))
247 )
250 )
248 (flags,) = args
251 (flags,) = args
249 actions[f] = (mergestatemod.ACTION_GET, (flags, backup), msg)
252 mresult.addfile(f, mergestatemod.ACTION_GET, (flags, backup), msg)
250
253
251
254
252 def _forgetremoved(wctx, mctx, branchmerge):
255 def _forgetremoved(wctx, mctx, branchmerge):
@@ -1022,7 +1025,7 b' def calculateupdates('
1022 acceptremote,
1025 acceptremote,
1023 followcopies,
1026 followcopies,
1024 )
1027 )
1025 _checkunknownfiles(repo, wctx, mctx, force, mresult.actions, mergeforce)
1028 _checkunknownfiles(repo, wctx, mctx, force, mresult, mergeforce)
1026
1029
1027 else: # only when merge.preferancestor=* - the default
1030 else: # only when merge.preferancestor=* - the default
1028 repo.ui.note(
1031 repo.ui.note(
@@ -1055,9 +1058,7 b' def calculateupdates('
1055 followcopies,
1058 followcopies,
1056 forcefulldiff=True,
1059 forcefulldiff=True,
1057 )
1060 )
1058 _checkunknownfiles(
1061 _checkunknownfiles(repo, wctx, mctx, force, mresult1, mergeforce)
1059 repo, wctx, mctx, force, mresult1.actions, mergeforce
1060 )
1061
1062
1062 # Track the shortest set of warning on the theory that bid
1063 # Track the shortest set of warning on the theory that bid
1063 # merge will correctly incorporate more information
1064 # merge will correctly incorporate more information
General Comments 0
You need to be logged in to leave comments. Login now