##// END OF EJS Templates
addremove: mapping isn't really needed, simplify
Benoit Boissinot -
r8488:4e1795cf default
parent child Browse files
Show More
@@ -286,7 +286,6 b' def addremove(repo, pats=[], opts={}, dr'
286 if similarity is None:
286 if similarity is None:
287 similarity = float(opts.get('similarity') or 0)
287 similarity = float(opts.get('similarity') or 0)
288 add, remove = [], []
288 add, remove = [], []
289 mapping = {}
290 audit_path = util.path_auditor(repo.root)
289 audit_path = util.path_auditor(repo.root)
291 m = match(repo, pats, opts)
290 m = match(repo, pats, opts)
292 for abs in repo.walk(m):
291 for abs in repo.walk(m):
@@ -300,13 +299,11 b' def addremove(repo, pats=[], opts={}, dr'
300 exact = m.exact(abs)
299 exact = m.exact(abs)
301 if good and abs not in repo.dirstate:
300 if good and abs not in repo.dirstate:
302 add.append(abs)
301 add.append(abs)
303 mapping[abs] = rel, m.exact(abs)
304 if repo.ui.verbose or not exact:
302 if repo.ui.verbose or not exact:
305 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
303 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
306 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
304 if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
307 or (os.path.isdir(target) and not os.path.islink(target))):
305 or (os.path.isdir(target) and not os.path.islink(target))):
308 remove.append(abs)
306 remove.append(abs)
309 mapping[abs] = rel, exact
310 if repo.ui.verbose or not exact:
307 if repo.ui.verbose or not exact:
311 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
308 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
312 if not dry_run:
309 if not dry_run:
@@ -314,9 +311,9 b' def addremove(repo, pats=[], opts={}, dr'
314 repo.add(add)
311 repo.add(add)
315 if similarity > 0:
312 if similarity > 0:
316 for old, new, score in findrenames(repo, add, remove, similarity):
313 for old, new, score in findrenames(repo, add, remove, similarity):
317 oldrel, oldexact = mapping[old]
314 oldexact, newexact = m.exact(old), m.exact(new)
318 newrel, newexact = mapping[new]
319 if repo.ui.verbose or not oldexact or not newexact:
315 if repo.ui.verbose or not oldexact or not newexact:
316 oldrel, newrel = m.rel(old), m.rel(new)
320 repo.ui.status(_('recording removal of %s as rename to %s '
317 repo.ui.status(_('recording removal of %s as rename to %s '
321 '(%d%% similar)\n') %
318 '(%d%% similar)\n') %
322 (oldrel, newrel, score * 100))
319 (oldrel, newrel, score * 100))
General Comments 0
You need to be logged in to leave comments. Login now