Show More
@@ -752,7 +752,9 b' def _showstats(repo, stats, quietempty=F' | |||
|
752 | 752 | if quietempty and not any(stats): |
|
753 | 753 | return |
|
754 | 754 | repo.ui.status(_("%d files updated, %d files merged, " |
|
755 |
"%d files removed, %d files unresolved\n") % |
|
|
755 | "%d files removed, %d files unresolved\n") % ( | |
|
756 | stats.updatedcount, stats.mergedcount, | |
|
757 | stats.removedcount, stats.unresolvedcount)) | |
|
756 | 758 | |
|
757 | 759 | def updaterepo(repo, node, overwrite, updatecheck=None): |
|
758 | 760 | """Update the working directory to node. |
@@ -22,6 +22,9 b' from .node import (' | |||
|
22 | 22 | nullid, |
|
23 | 23 | nullrev, |
|
24 | 24 | ) |
|
25 | from .thirdparty import ( | |
|
26 | attr, | |
|
27 | ) | |
|
25 | 28 | from . import ( |
|
26 | 29 | copies, |
|
27 | 30 | error, |
@@ -1398,6 +1401,30 b' def _prefetchfiles(repo, ctx, actions):' | |||
|
1398 | 1401 | prefetch = scmutil.fileprefetchhooks |
|
1399 | 1402 | prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist]) |
|
1400 | 1403 | |
|
1404 | @attr.s(frozen=True) | |
|
1405 | class updateresult(object): | |
|
1406 | updatedcount = attr.ib() | |
|
1407 | mergedcount = attr.ib() | |
|
1408 | removedcount = attr.ib() | |
|
1409 | unresolvedcount = attr.ib() | |
|
1410 | ||
|
1411 | # TODO remove container emulation once consumers switch to new API. | |
|
1412 | ||
|
1413 | def __getitem__(self, x): | |
|
1414 | if x == 0: | |
|
1415 | return self.updatedcount | |
|
1416 | elif x == 1: | |
|
1417 | return self.mergedcount | |
|
1418 | elif x == 2: | |
|
1419 | return self.removedcount | |
|
1420 | elif x == 3: | |
|
1421 | return self.unresolvedcount | |
|
1422 | else: | |
|
1423 | raise IndexError('can only access items 0-3') | |
|
1424 | ||
|
1425 | def __len__(self): | |
|
1426 | return 4 | |
|
1427 | ||
|
1401 | 1428 | def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): |
|
1402 | 1429 | """apply the merge action list to the working directory |
|
1403 | 1430 | |
@@ -1581,7 +1608,8 b' def applyupdates(repo, actions, wctx, mc' | |||
|
1581 | 1608 | if not proceed: |
|
1582 | 1609 | # XXX setting unresolved to at least 1 is a hack to make sure we |
|
1583 | 1610 | # error out |
|
1584 |
return updated, merged, removed, |
|
|
1611 | return updateresult(updated, merged, removed, | |
|
1612 | max(len(unresolvedf), 1)) | |
|
1585 | 1613 | newactions = [] |
|
1586 | 1614 | for f, args, msg in mergeactions: |
|
1587 | 1615 | if f in unresolvedf: |
@@ -1656,8 +1684,7 b' def applyupdates(repo, actions, wctx, mc' | |||
|
1656 | 1684 | actions['m'] = [a for a in actions['m'] if a[0] in mfiles] |
|
1657 | 1685 | |
|
1658 | 1686 | progress(_updating, None, total=numupdates, unit=_files) |
|
1659 | ||
|
1660 | return updated, merged, removed, unresolved | |
|
1687 | return updateresult(updated, merged, removed, unresolved) | |
|
1661 | 1688 | |
|
1662 | 1689 | def recordupdates(repo, actions, branchmerge): |
|
1663 | 1690 | "record merge actions to the dirstate" |
@@ -1878,7 +1905,7 b' def update(repo, node, branchmerge, forc' | |||
|
1878 | 1905 | # call the hooks and exit early |
|
1879 | 1906 | repo.hook('preupdate', throw=True, parent1=xp2, parent2='') |
|
1880 | 1907 | repo.hook('update', parent1=xp2, parent2='', error=0) |
|
1881 | return 0, 0, 0, 0 | |
|
1908 | return updateresult(0, 0, 0, 0) | |
|
1882 | 1909 | |
|
1883 | 1910 | if (updatecheck == 'linear' and |
|
1884 | 1911 | pas not in ([p1], [p2])): # nonlinear |
General Comments 0
You need to be logged in to leave comments.
Login now