Mercurial > hg
changeset 27078:a421debae31d
merge.applyupdates: use counters from mergestate
This eliminates a whole bunch of duplicate code and allows us to update the
removed count for change/delete conflicts where the delete action was chosen.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 20 Nov 2015 16:37:39 -0800 |
parents | ca3fbf9dad8c |
children | a88a10a933b2 |
files | mercurial/merge.py |
diffstat | 1 files changed, 9 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Nov 20 16:18:51 2015 -0800 +++ b/mercurial/merge.py Fri Nov 20 16:37:39 2015 -0800 @@ -944,7 +944,7 @@ describes how many files were affected by the update. """ - updated, merged, removed, unresolved = 0, 0, 0, 0 + updated, merged, removed = 0, 0, 0 ms = mergestate.clean(repo, wctx.p1().node(), mctx.node()) moves = [] for m, l in actions.items(): @@ -1084,15 +1084,7 @@ continue audit(f) complete, r = ms.preresolve(f, wctx, labels=labels) - if complete: - if r is not None and r > 0: - unresolved += 1 - else: - if r is None: - updated += 1 - else: - merged += 1 - else: + if not complete: numupdates += 1 tocomplete.append((f, args, msg)) @@ -1101,17 +1093,12 @@ repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) z += 1 progress(_updating, z, item=f, total=numupdates, unit=_files) - r = ms.resolve(f, wctx, labels=labels) - if r is not None and r > 0: - unresolved += 1 - else: - if r is None: - updated += 1 - else: - merged += 1 + ms.resolve(f, wctx, labels=labels) ms.commit() + unresolved = ms.unresolvedcount() + if usemergedriver and not unresolved and ms.mdstate() != 's': if not driverconclude(repo, ms, wctx, labels=labels): # XXX setting unresolved to at least 1 is a hack to make sure we @@ -1120,6 +1107,10 @@ ms.commit() + msupdated, msmerged, msremoved = ms.counts() + updated += msupdated + merged += msmerged + removed += msremoved progress(_updating, None, total=numupdates, unit=_files) return updated, merged, removed, unresolved