Mercurial > hg
changeset 18863:1b70e5941ad7
scmutil.addremove: pull ui.status printing out of the loop
This will let us stop sorting all the results in an upcoming patch.
This also permits future refactorings where the same code consumes
dirstate.walk results but doesn't print anything out.
An argument could be made that printing out results as we go along is more
responsive UI-wise. However, at this point iterating through walk results is
actually faster than sorting them, so once we stop sorting all the results the
argument ceases to be valid.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 02 Apr 2013 10:56:24 -0700 |
parents | 6de8cd5c719a |
children | 887b75fda169 |
files | mercurial/scmutil.py |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Tue Apr 02 14:49:34 2013 -0700 +++ b/mercurial/scmutil.py Tue Apr 02 10:56:24 2013 -0700 @@ -683,19 +683,26 @@ dstate = dirstate[abs] if dstate == '?' and audit_path.check(abs): unknown.append(abs) - if repo.ui.verbose or not m.exact(abs): - rel = m.rel(abs) - repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) elif dstate != 'r' and not st: deleted.append(abs) - if repo.ui.verbose or not m.exact(abs): - rel = m.rel(abs) - repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) # for finding renames elif dstate == 'r': removed.append(abs) elif dstate == 'a': added.append(abs) + + unknownset = set(unknown) + toprint = unknownset.copy() + toprint.update(deleted) + for abs in sorted(toprint): + if repo.ui.verbose or not m.exact(abs): + rel = m.rel(abs) + if abs in unknownset: + status = _('adding %s\n') % ((pats and rel) or abs) + else: + status = _('removing %s\n') % ((pats and rel) or abs) + repo.ui.status(status) + copies = {} if similarity > 0: for old, new, score in similar.findrenames(repo,