Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 8489:1a96f1d9599b
addremove/findrenames: find renames according to the match object (issue1527)
Instead of only finding similarities in the added/removed files found
by the addremove step, follow the match object:
hg addremove -s80 foo -> add and removes files in foo
+ find similarities between files in foo
hg addremove -s80 -> add and removes files in the whole repo
+ find similarities between files in the whole repo
hg import --similarity will still work correctly (only find similarities
between files found in the patch).
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 17 May 2009 22:51:17 +0200 |
parents | 4e1795cf6e94 |
children | ff22d4c3ac04 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sun May 17 22:40:04 2009 +0200 +++ b/mercurial/cmdutil.py Sun May 17 22:51:17 2009 +0200 @@ -252,10 +252,9 @@ def matchfiles(repo, files): return _match.exact(repo.root, repo.getcwd(), files) -def findrenames(repo, added=None, removed=None, threshold=0.5): +def findrenames(repo, match=None, threshold=0.5): '''find renamed files -- yields (before, after, score) tuples''' - if added is None or removed is None: - added, removed = repo.status()[1:3] + added, removed = repo.status(match=match)[1:3] ctx = repo['.'] for a in added: aa = repo.wread(a) @@ -310,7 +309,7 @@ repo.remove(remove) repo.add(add) if similarity > 0: - for old, new, score in findrenames(repo, add, remove, similarity): + for old, new, score in findrenames(repo, m, similarity): 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)