changeset 8488:4e1795cf6e94

addremove: mapping isn't really needed, simplify
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 17 May 2009 22:40:04 +0200
parents 15573b5dc78f
children 1a96f1d9599b
files mercurial/cmdutil.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun May 17 20:00:11 2009 +0200
+++ b/mercurial/cmdutil.py	Sun May 17 22:40:04 2009 +0200
@@ -286,7 +286,6 @@
     if similarity is None:
         similarity = float(opts.get('similarity') or 0)
     add, remove = [], []
-    mapping = {}
     audit_path = util.path_auditor(repo.root)
     m = match(repo, pats, opts)
     for abs in repo.walk(m):
@@ -300,13 +299,11 @@
         exact = m.exact(abs)
         if good and abs not in repo.dirstate:
             add.append(abs)
-            mapping[abs] = rel, m.exact(abs)
             if repo.ui.verbose or not exact:
                 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
         if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
             or (os.path.isdir(target) and not os.path.islink(target))):
             remove.append(abs)
-            mapping[abs] = rel, exact
             if repo.ui.verbose or not exact:
                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
     if not dry_run:
@@ -314,9 +311,9 @@
         repo.add(add)
     if similarity > 0:
         for old, new, score in findrenames(repo, add, remove, similarity):
-            oldrel, oldexact = mapping[old]
-            newrel, newexact = mapping[new]
+            oldexact, newexact = m.exact(old), m.exact(new)
             if repo.ui.verbose or not oldexact or not newexact:
+                oldrel, newrel = m.rel(old), m.rel(new)
                 repo.ui.status(_('recording removal of %s as rename to %s '
                                  '(%d%% similar)\n') %
                                (oldrel, newrel, score * 100))