##// END OF EJS Templates
mergeresult: yield from getactions() instead of buidling a list and returning...
Pulkit Goyal -
r45900:cdc50e19 default
parent child Browse files
Show More
@@ -175,8 +175,8 b' def _checkunknownfiles(repo, wctx, mctx,'
175 collectconflicts(ignoredconflicts, ignoredconfig)
175 collectconflicts(ignoredconflicts, ignoredconfig)
176 collectconflicts(unknownconflicts, unknownconfig)
176 collectconflicts(unknownconflicts, unknownconfig)
177 else:
177 else:
178 for f, args, msg in mresult.getactions(
178 for f, args, msg in list(
179 [mergestatemod.ACTION_CREATED_MERGE]
179 mresult.getactions([mergestatemod.ACTION_CREATED_MERGE])
180 ):
180 ):
181 fl2, anc = args
181 fl2, anc = args
182 different = _checkunknownfile(repo, wctx, mctx, f)
182 different = _checkunknownfile(repo, wctx, mctx, f)
@@ -243,7 +243,9 b' def _checkunknownfiles(repo, wctx, mctx,'
243 else:
243 else:
244 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)
245
245
246 for f, args, msg in mresult.getactions([mergestatemod.ACTION_CREATED]):
246 for f, args, msg in list(
247 mresult.getactions([mergestatemod.ACTION_CREATED])
248 ):
247 backup = (
249 backup = (
248 f in fileconflicts
250 f in fileconflicts
249 or f in pathconflicts
251 or f in pathconflicts
@@ -610,18 +612,16 b' class mergeresult(object):'
610
612
611 Returns a list of tuple of form (filename, data, message)
613 Returns a list of tuple of form (filename, data, message)
612 """
614 """
613 res = []
614 for a in actions:
615 for a in actions:
615 if sort:
616 if sort:
616 for f in sorted(self._actionmapping[a]):
617 for f in sorted(self._actionmapping[a]):
617 args, msg = self._actionmapping[a][f]
618 args, msg = self._actionmapping[a][f]
618 res.append((f, args, msg))
619 yield f, args, msg
619 else:
620 else:
620 for f, (args, msg) in pycompat.iteritems(
621 for f, (args, msg) in pycompat.iteritems(
621 self._actionmapping[a]
622 self._actionmapping[a]
622 ):
623 ):
623 res.append((f, args, msg))
624 yield f, args, msg
624 return res
625
625
626 def len(self, actions=None):
626 def len(self, actions=None):
627 """ returns number of files which needs actions
627 """ returns number of files which needs actions
@@ -1007,8 +1007,8 b' def _resolvetrivial(repo, wctx, mctx, an'
1007 remained the same."""
1007 remained the same."""
1008 # We force a copy of actions.items() because we're going to mutate
1008 # We force a copy of actions.items() because we're going to mutate
1009 # actions as we resolve trivial conflicts.
1009 # actions as we resolve trivial conflicts.
1010 for f, args, msg in mresult.getactions(
1010 for f, args, msg in list(
1011 [mergestatemod.ACTION_CHANGED_DELETED]
1011 mresult.getactions([mergestatemod.ACTION_CHANGED_DELETED])
1012 ):
1012 ):
1013 if f in ancestor and not wctx[f].cmp(ancestor[f]):
1013 if f in ancestor and not wctx[f].cmp(ancestor[f]):
1014 # local did change but ended up with same content
1014 # local did change but ended up with same content
@@ -1382,13 +1382,15 b' def applyupdates('
1382 moves = []
1382 moves = []
1383
1383
1384 # 'cd' and 'dc' actions are treated like other merge conflicts
1384 # 'cd' and 'dc' actions are treated like other merge conflicts
1385 mergeactions = mresult.getactions(
1385 mergeactions = list(
1386 [
1386 mresult.getactions(
1387 mergestatemod.ACTION_CHANGED_DELETED,
1387 [
1388 mergestatemod.ACTION_DELETED_CHANGED,
1388 mergestatemod.ACTION_CHANGED_DELETED,
1389 mergestatemod.ACTION_MERGE,
1389 mergestatemod.ACTION_DELETED_CHANGED,
1390 ],
1390 mergestatemod.ACTION_MERGE,
1391 sort=True,
1391 ],
1392 sort=True,
1393 )
1392 )
1394 )
1393 for f, args, msg in mergeactions:
1395 for f, args, msg in mergeactions:
1394 f1, f2, fa, move, anc = args
1396 f1, f2, fa, move, anc = args
@@ -1459,7 +1461,7 b' def applyupdates('
1459 cost,
1461 cost,
1460 batchremove,
1462 batchremove,
1461 (repo, wctx),
1463 (repo, wctx),
1462 mresult.getactions([mergestatemod.ACTION_REMOVE], sort=True),
1464 list(mresult.getactions([mergestatemod.ACTION_REMOVE], sort=True)),
1463 )
1465 )
1464 for i, item in prog:
1466 for i, item in prog:
1465 progress.increment(step=i, item=item)
1467 progress.increment(step=i, item=item)
@@ -1487,7 +1489,7 b' def applyupdates('
1487 cost,
1489 cost,
1488 batchget,
1490 batchget,
1489 (repo, mctx, wctx, wantfiledata),
1491 (repo, mctx, wctx, wantfiledata),
1490 mresult.getactions([mergestatemod.ACTION_GET], sort=True),
1492 list(mresult.getactions([mergestatemod.ACTION_GET], sort=True)),
1491 threadsafe=threadsafe,
1493 threadsafe=threadsafe,
1492 hasretval=True,
1494 hasretval=True,
1493 )
1495 )
@@ -1667,7 +1669,7 b' def applyupdates('
1667 # those lists aren't consulted again.
1669 # those lists aren't consulted again.
1668 mfiles.difference_update(a[0] for a in acts)
1670 mfiles.difference_update(a[0] for a in acts)
1669
1671
1670 for a in mresult.getactions([mergestatemod.ACTION_MERGE]):
1672 for a in list(mresult.getactions((mergestatemod.ACTION_MERGE,))):
1671 if a[0] not in mfiles:
1673 if a[0] not in mfiles:
1672 mresult.removefile(a[0])
1674 mresult.removefile(a[0])
1673
1675
General Comments 0
You need to be logged in to leave comments. Login now