mercurial/cmdutil.py
changeset 8489 1a96f1d9599b
parent 8488 4e1795cf6e94
child 8497 ff22d4c3ac04
equal deleted inserted replaced
8488:4e1795cf6e94 8489:1a96f1d9599b
   250     return _match.always(repo.root, repo.getcwd())
   250     return _match.always(repo.root, repo.getcwd())
   251 
   251 
   252 def matchfiles(repo, files):
   252 def matchfiles(repo, files):
   253     return _match.exact(repo.root, repo.getcwd(), files)
   253     return _match.exact(repo.root, repo.getcwd(), files)
   254 
   254 
   255 def findrenames(repo, added=None, removed=None, threshold=0.5):
   255 def findrenames(repo, match=None, threshold=0.5):
   256     '''find renamed files -- yields (before, after, score) tuples'''
   256     '''find renamed files -- yields (before, after, score) tuples'''
   257     if added is None or removed is None:
   257     added, removed = repo.status(match=match)[1:3]
   258         added, removed = repo.status()[1:3]
       
   259     ctx = repo['.']
   258     ctx = repo['.']
   260     for a in added:
   259     for a in added:
   261         aa = repo.wread(a)
   260         aa = repo.wread(a)
   262         bestname, bestscore = None, threshold
   261         bestname, bestscore = None, threshold
   263         for r in removed:
   262         for r in removed:
   308                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
   307                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
   309     if not dry_run:
   308     if not dry_run:
   310         repo.remove(remove)
   309         repo.remove(remove)
   311         repo.add(add)
   310         repo.add(add)
   312     if similarity > 0:
   311     if similarity > 0:
   313         for old, new, score in findrenames(repo, add, remove, similarity):
   312         for old, new, score in findrenames(repo, m, similarity):
   314             oldexact, newexact = m.exact(old), m.exact(new)
   313             oldexact, newexact = m.exact(old), m.exact(new)
   315             if repo.ui.verbose or not oldexact or not newexact:
   314             if repo.ui.verbose or not oldexact or not newexact:
   316                 oldrel, newrel = m.rel(old), m.rel(new)
   315                 oldrel, newrel = m.rel(old), m.rel(new)
   317                 repo.ui.status(_('recording removal of %s as rename to %s '
   316                 repo.ui.status(_('recording removal of %s as rename to %s '
   318                                  '(%d%% similar)\n') %
   317                                  '(%d%% similar)\n') %