##// END OF EJS Templates
merge: add mergeresult.mapaction to improve speed...
Arseniy Alekseyev -
r50806:c7a04bfa default
parent child Browse files
Show More
@@ -246,9 +246,7 b' def _checkunknownfiles(repo, wctx, mctx,'
246 else:
246 else:
247 repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f)
247 repo.ui.warn(_(b"%s: replacing untracked files in directory\n") % f)
248
248
249 for f, args, msg in list(
249 def transformargs(f, args):
250 mresult.getactions([mergestatemod.ACTION_CREATED])
251 ):
252 backup = (
250 backup = (
253 f in fileconflicts
251 f in fileconflicts
254 or pathconflicts
252 or pathconflicts
@@ -258,7 +256,11 b' def _checkunknownfiles(repo, wctx, mctx,'
258 )
256 )
259 )
257 )
260 (flags,) = args
258 (flags,) = args
261 mresult.addfile(f, mergestatemod.ACTION_GET, (flags, backup), msg)
259 return (flags, backup)
260
261 mresult.mapaction(
262 mergestatemod.ACTION_CREATED, mergestatemod.ACTION_GET, transformargs
263 )
262
264
263
265
264 def _forgetremoved(wctx, mctx, branchmerge, mresult):
266 def _forgetremoved(wctx, mctx, branchmerge, mresult):
@@ -590,6 +592,18 b' class mergeresult:'
590 self._filemapping[filename] = (action, data, message)
592 self._filemapping[filename] = (action, data, message)
591 self._actionmapping[action][filename] = (data, message)
593 self._actionmapping[action][filename] = (data, message)
592
594
595 def mapaction(self, actionfrom, actionto, transform):
596 """changes all occurrences of action `actionfrom` into `actionto`,
597 transforming its args with the function `transform`.
598 """
599 orig = self._actionmapping[actionfrom]
600 del self._actionmapping[actionfrom]
601 dest = self._actionmapping[actionto]
602 for f, (data, msg) in orig.items():
603 data = transform(f, data)
604 self._filemapping[f] = (actionto, data, msg)
605 dest[f] = (data, msg)
606
593 def getfile(self, filename, default_return=None):
607 def getfile(self, filename, default_return=None):
594 """returns (action, args, msg) about this file
608 """returns (action, args, msg) about this file
595
609
General Comments 0
You need to be logged in to leave comments. Login now