##// 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 res.append((f, args, msg))
623 res.append((f, args, msg))
624 return res
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 @property
637 @property
627 def actions(self):
638 def actions(self):
628 return self._filemapping
639 return self._filemapping
@@ -1409,9 +1420,7 b' def applyupdates('
1409 wctx[f].audit()
1420 wctx[f].audit()
1410 wctx[f].remove()
1421 wctx[f].remove()
1411
1422
1412 numupdates = len(mresult.actions) - len(
1423 numupdates = mresult.len() - mresult.len((mergestatemod.ACTION_KEEP,))
1413 mresult._actionmapping[mergestatemod.ACTION_KEEP]
1414 )
1415 progress = repo.ui.makeprogress(
1424 progress = repo.ui.makeprogress(
1416 _(b'updating'), unit=_(b'files'), total=numupdates
1425 _(b'updating'), unit=_(b'files'), total=numupdates
1417 )
1426 )
@@ -1454,7 +1463,7 b' def applyupdates('
1454 )
1463 )
1455 for i, item in prog:
1464 for i, item in prog:
1456 progress.increment(step=i, item=item)
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 # resolve path conflicts (must come before getting)
1468 # resolve path conflicts (must come before getting)
1460 for f, args, msg in mresult.getactions(
1469 for f, args, msg in mresult.getactions(
@@ -1489,7 +1498,7 b' def applyupdates('
1489 else:
1498 else:
1490 i, item = res
1499 i, item = res
1491 progress.increment(step=i, item=item)
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 if b'.hgsubstate' in mresult._actionmapping[mergestatemod.ACTION_GET]:
1503 if b'.hgsubstate' in mresult._actionmapping[mergestatemod.ACTION_GET]:
1495 subrepoutil.submerge(repo, wctx, mctx, wctx, overwrite, labels)
1504 subrepoutil.submerge(repo, wctx, mctx, wctx, overwrite, labels)
@@ -1664,9 +1673,7 b' def applyupdates('
1664
1673
1665 progress.complete()
1674 progress.complete()
1666 assert len(getfiledata) == (
1675 assert len(getfiledata) == (
1667 len(mresult._actionmapping[mergestatemod.ACTION_GET])
1676 mresult.len((mergestatemod.ACTION_GET,)) if wantfiledata else 0
1668 if wantfiledata
1669 else 0
1670 )
1677 )
1671 return updateresult(updated, merged, removed, unresolved), getfiledata
1678 return updateresult(updated, merged, removed, unresolved), getfiledata
1672
1679
@@ -2031,11 +2038,8 b' def update('
2031 # note that we're in the middle of an update
2038 # note that we're in the middle of an update
2032 repo.vfs.write(b'updatestate', p2.hex())
2039 repo.vfs.write(b'updatestate', p2.hex())
2033
2040
2034 # Convert to dictionary-of-lists format
2035 actions = mresult.actionsdict
2036
2037 _advertisefsmonitor(
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 wantfiledata = updatedirstate and not branchmerge
2045 wantfiledata = updatedirstate and not branchmerge
General Comments 0
You need to be logged in to leave comments. Login now