##// END OF EJS Templates
mergeresult: implement a len() function and use it...
Pulkit Goyal -
r45898:72b8c082 default
parent child Browse files
Show More
@@ -623,6 +623,17 b' class mergeresult(object):'
623 623 res.append((f, args, msg))
624 624 return res
625 625
626 def len(self, actions=None):
627 """ returns number of files which needs actions
628
629 if actions is passed, total of number of files in that action
630 only is returned """
631
632 if actions is None:
633 return len(self._filemapping)
634
635 return sum(len(self._actionmapping[a]) for a in actions)
636
626 637 @property
627 638 def actions(self):
628 639 return self._filemapping
@@ -1409,9 +1420,7 b' def applyupdates('
1409 1420 wctx[f].audit()
1410 1421 wctx[f].remove()
1411 1422
1412 numupdates = len(mresult.actions) - len(
1413 mresult._actionmapping[mergestatemod.ACTION_KEEP]
1414 )
1423 numupdates = mresult.len() - mresult.len((mergestatemod.ACTION_KEEP,))
1415 1424 progress = repo.ui.makeprogress(
1416 1425 _(b'updating'), unit=_(b'files'), total=numupdates
1417 1426 )
@@ -1454,7 +1463,7 b' def applyupdates('
1454 1463 )
1455 1464 for i, item in prog:
1456 1465 progress.increment(step=i, item=item)
1457 removed = len(mresult._actionmapping[mergestatemod.ACTION_REMOVE])
1466 removed = mresult.len((mergestatemod.ACTION_REMOVE,))
1458 1467
1459 1468 # resolve path conflicts (must come before getting)
1460 1469 for f, args, msg in mresult.getactions(
@@ -1489,7 +1498,7 b' def applyupdates('
1489 1498 else:
1490 1499 i, item = res
1491 1500 progress.increment(step=i, item=item)
1492 updated = len(mresult._actionmapping[mergestatemod.ACTION_GET])
1501 updated = mresult.len((mergestatemod.ACTION_GET,))
1493 1502
1494 1503 if b'.hgsubstate' in mresult._actionmapping[mergestatemod.ACTION_GET]:
1495 1504 subrepoutil.submerge(repo, wctx, mctx, wctx, overwrite, labels)
@@ -1664,9 +1673,7 b' def applyupdates('
1664 1673
1665 1674 progress.complete()
1666 1675 assert len(getfiledata) == (
1667 len(mresult._actionmapping[mergestatemod.ACTION_GET])
1668 if wantfiledata
1669 else 0
1676 mresult.len((mergestatemod.ACTION_GET,)) if wantfiledata else 0
1670 1677 )
1671 1678 return updateresult(updated, merged, removed, unresolved), getfiledata
1672 1679
@@ -2031,11 +2038,8 b' def update('
2031 2038 # note that we're in the middle of an update
2032 2039 repo.vfs.write(b'updatestate', p2.hex())
2033 2040
2034 # Convert to dictionary-of-lists format
2035 actions = mresult.actionsdict
2036
2037 2041 _advertisefsmonitor(
2038 repo, len(actions[mergestatemod.ACTION_GET]), p1.node()
2042 repo, mresult.len((mergestatemod.ACTION_GET,)), p1.node()
2039 2043 )
2040 2044
2041 2045 wantfiledata = updatedirstate and not branchmerge
General Comments 0
You need to be logged in to leave comments. Login now