Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 37128:6f570c501e3e
merge: deprecate accessing update results by index
Now that we have named attributes, let's convert the code base to use
them. We also add deprecation warnings so legacy consumers are aware
of their transgressions.
``stats.unresolvedcount`` is much easier to read than ``stats[3]``,
don't you think?
Differential Revision: https://phab.mercurial-scm.org/D2694
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 05 Mar 2018 00:30:00 -0500 |
parents | 71543b942eea |
children | 3809eafedf2c |
line wrap: on
line diff
--- a/mercurial/hg.py Sun Mar 25 11:58:05 2018 +0900 +++ b/mercurial/hg.py Mon Mar 05 00:30:00 2018 -0500 @@ -749,7 +749,7 @@ return srcpeer, destpeer def _showstats(repo, stats, quietempty=False): - if quietempty and not any(stats): + if quietempty and stats.isempty(): return repo.ui.status(_("%d files updated, %d files merged, " "%d files removed, %d files unresolved\n") % ( @@ -770,9 +770,9 @@ """update the working directory to node""" stats = updaterepo(repo, node, False, updatecheck=updatecheck) _showstats(repo, stats, quietempty) - if stats[3]: + if stats.unresolvedcount: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) - return stats[3] > 0 + return stats.unresolvedcount > 0 # naming conflict in clone() _update = update @@ -783,7 +783,7 @@ repo.vfs.unlinkpath('graftstate', ignoremissing=True) if show_stats: _showstats(repo, stats, quietempty) - return stats[3] > 0 + return stats.unresolvedcount > 0 # naming conflict in updatetotally() _clean = clean @@ -882,12 +882,12 @@ labels=labels) _showstats(repo, stats) - if stats[3]: + if stats.unresolvedcount: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " "or 'hg merge --abort' to abandon\n")) elif remind and not abort: repo.ui.status(_("(branch merge, don't forget to commit)\n")) - return stats[3] > 0 + return stats.unresolvedcount > 0 def _incoming(displaychlist, subreporecurse, ui, repo, source, opts, buffered=False):