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.
( )
mbthomas | |
durin42 |
hg-reviewers |
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.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/merge.py (46 lines) |
Commit | Local | Parents | Author | Summary | Date |
---|---|---|---|---|---|
1d4be2a8016b | 37523 | 457bc1115f99 | Ryan McElroy | merge: ensure that we always commit the mergestate (Show More…) | Oct 4 2017, 9:54 AM |
# error out | # error out | ||||
return updated, merged, removed, max(len(unresolvedf), 1) | return updated, merged, removed, max(len(unresolvedf), 1) | ||||
newactions = [] | newactions = [] | ||||
for f, args, msg in mergeactions: | for f, args, msg in mergeactions: | ||||
if f in unresolvedf: | if f in unresolvedf: | ||||
newactions.append((f, args, msg)) | newactions.append((f, args, msg)) | ||||
mergeactions = newactions | mergeactions = newactions | ||||
try: | |||||
# premerge | # premerge | ||||
tocomplete = [] | tocomplete = [] | ||||
for f, args, msg in mergeactions: | for f, args, msg in mergeactions: | ||||
repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) | repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) | ||||
z += 1 | z += 1 | ||||
progress(_updating, z, item=f, total=numupdates, unit=_files) | progress(_updating, z, item=f, total=numupdates, unit=_files) | ||||
if f == '.hgsubstate': # subrepo states need updating | if f == '.hgsubstate': # subrepo states need updating | ||||
subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | ||||
overwrite, labels) | overwrite, labels) | ||||
continue | continue | ||||
wctx[f].audit() | wctx[f].audit() | ||||
complete, r = ms.preresolve(f, wctx) | complete, r = ms.preresolve(f, wctx) | ||||
if not complete: | if not complete: | ||||
numupdates += 1 | numupdates += 1 | ||||
tocomplete.append((f, args, msg)) | tocomplete.append((f, args, msg)) | ||||
# merge | # merge | ||||
for f, args, msg in tocomplete: | for f, args, msg in tocomplete: | ||||
repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) | repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) | ||||
z += 1 | z += 1 | ||||
progress(_updating, z, item=f, total=numupdates, unit=_files) | progress(_updating, z, item=f, total=numupdates, unit=_files) | ||||
ms.resolve(f, wctx) | ms.resolve(f, wctx) | ||||
finally: | |||||
ms.commit() | ms.commit() | ||||
unresolved = ms.unresolvedcount() | unresolved = ms.unresolvedcount() | ||||
if usemergedriver and not unresolved and ms.mdstate() != 's': | if usemergedriver and not unresolved and ms.mdstate() != 's': | ||||
if not driverconclude(repo, ms, wctx, labels=labels): | if not driverconclude(repo, ms, wctx, labels=labels): | ||||
# XXX setting unresolved to at least 1 is a hack to make sure we | # XXX setting unresolved to at least 1 is a hack to make sure we | ||||
# error out | # error out | ||||
unresolved = max(unresolved, 1) | unresolved = max(unresolved, 1) |