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