Mercurial > hg
changeset 27076:09139ccf3085
mergestate: add a method to return updated/merged/removed counts
This will not only allow us to remove a bunch of duplicate code in applyupdates
in an upcoming patch, it will also allow the resolve interface to be a lot
simpler: it doesn't need to return the dirstate action to applyupdates.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 20 Nov 2015 16:17:54 -0800 |
parents | 6373330155b2 |
children | ca3fbf9dad8c |
files | mercurial/merge.py |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Nov 20 16:32:47 2015 -0800 +++ b/mercurial/merge.py Fri Nov 20 16:17:54 2015 -0800 @@ -490,6 +490,20 @@ Returns the exit code of the merge.""" return self._resolve(False, dfile, wctx, labels=labels)[1] + def counts(self): + """return counts for updated, merged and removed files in this + session""" + updated, merged, removed = 0, 0, 0 + for r, action in self._results.itervalues(): + if r is None: + updated += 1 + elif r == 0: + if action == 'r': + removed += 1 + else: + merged += 1 + return updated, merged, removed + def _checkunknownfile(repo, wctx, mctx, f, f2=None): if f2 is None: f2 = f