Mercurial > hg
comparison mercurial/merge.py @ 34680:c0a524f77e8a
merge: ensure that we always commit the mergestate
In future patches, we may halt the merge process based on configuration or
user requests by raising exceptions. We need to ensure that the mergestate
is unconditionally committed even when such an exception is raised.
Depends on D930.
Differential Revision: https://phab.mercurial-scm.org/D931
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Fri, 06 Oct 2017 06:48:43 -0700 |
parents | 1248aa48cac9 |
children | 9c899660700a |
comparison
equal
deleted
inserted
replaced
34679:143337bcec9b | 34680:c0a524f77e8a |
---|---|
1535 for f, args, msg in mergeactions: | 1535 for f, args, msg in mergeactions: |
1536 if f in unresolvedf: | 1536 if f in unresolvedf: |
1537 newactions.append((f, args, msg)) | 1537 newactions.append((f, args, msg)) |
1538 mergeactions = newactions | 1538 mergeactions = newactions |
1539 | 1539 |
1540 # premerge | 1540 try: |
1541 tocomplete = [] | 1541 # premerge |
1542 for f, args, msg in mergeactions: | 1542 tocomplete = [] |
1543 repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) | 1543 for f, args, msg in mergeactions: |
1544 z += 1 | 1544 repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) |
1545 progress(_updating, z, item=f, total=numupdates, unit=_files) | 1545 z += 1 |
1546 if f == '.hgsubstate': # subrepo states need updating | 1546 progress(_updating, z, item=f, total=numupdates, unit=_files) |
1547 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | 1547 if f == '.hgsubstate': # subrepo states need updating |
1548 overwrite, labels) | 1548 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
1549 continue | 1549 overwrite, labels) |
1550 wctx[f].audit() | 1550 continue |
1551 complete, r = ms.preresolve(f, wctx) | 1551 wctx[f].audit() |
1552 if not complete: | 1552 complete, r = ms.preresolve(f, wctx) |
1553 numupdates += 1 | 1553 if not complete: |
1554 tocomplete.append((f, args, msg)) | 1554 numupdates += 1 |
1555 | 1555 tocomplete.append((f, args, msg)) |
1556 # merge | 1556 |
1557 for f, args, msg in tocomplete: | 1557 # merge |
1558 repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) | 1558 for f, args, msg in tocomplete: |
1559 z += 1 | 1559 repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) |
1560 progress(_updating, z, item=f, total=numupdates, unit=_files) | 1560 z += 1 |
1561 ms.resolve(f, wctx) | 1561 progress(_updating, z, item=f, total=numupdates, unit=_files) |
1562 | 1562 ms.resolve(f, wctx) |
1563 ms.commit() | 1563 |
1564 finally: | |
1565 ms.commit() | |
1564 | 1566 |
1565 unresolved = ms.unresolvedcount() | 1567 unresolved = ms.unresolvedcount() |
1566 | 1568 |
1567 if usemergedriver and not unresolved and ms.mdstate() != 's': | 1569 if usemergedriver and not unresolved and ms.mdstate() != 's': |
1568 if not driverconclude(repo, ms, wctx, labels=labels): | 1570 if not driverconclude(repo, ms, wctx, labels=labels): |