comparison mercurial/cmdutil.py @ 4961:126f527b3ba3

Make repo locks recursive, eliminate all passing of lock/wlock
author Matt Mackall <mpm@selenic.com>
date Sat, 21 Jul 2007 16:02:10 -0500
parents 30847b8af7ca
children 4106dde15aed
comparison
equal deleted inserted replaced
4960:5c5d23d93447 4961:126f527b3ba3
626 if myscore >= bestscore: 626 if myscore >= bestscore:
627 bestname, bestscore = r, myscore 627 bestname, bestscore = r, myscore
628 if bestname: 628 if bestname:
629 yield bestname, a, bestscore 629 yield bestname, a, bestscore
630 630
631 def addremove(repo, pats=[], opts={}, wlock=None, dry_run=None, 631 def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
632 similarity=None):
633 if dry_run is None: 632 if dry_run is None:
634 dry_run = opts.get('dry_run') 633 dry_run = opts.get('dry_run')
635 if similarity is None: 634 if similarity is None:
636 similarity = float(opts.get('similarity') or 0) 635 similarity = float(opts.get('similarity') or 0)
637 add, remove = [], [] 636 add, remove = [], []
647 remove.append(abs) 646 remove.append(abs)
648 mapping[abs] = rel, exact 647 mapping[abs] = rel, exact
649 if repo.ui.verbose or not exact: 648 if repo.ui.verbose or not exact:
650 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) 649 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
651 if not dry_run: 650 if not dry_run:
652 repo.add(add, wlock=wlock) 651 repo.add(add)
653 repo.remove(remove, wlock=wlock) 652 repo.remove(remove)
654 if similarity > 0: 653 if similarity > 0:
655 for old, new, score in findrenames(repo, add, remove, similarity): 654 for old, new, score in findrenames(repo, add, remove, similarity):
656 oldrel, oldexact = mapping[old] 655 oldrel, oldexact = mapping[old]
657 newrel, newexact = mapping[new] 656 newrel, newexact = mapping[new]
658 if repo.ui.verbose or not oldexact or not newexact: 657 if repo.ui.verbose or not oldexact or not newexact:
659 repo.ui.status(_('recording removal of %s as rename to %s ' 658 repo.ui.status(_('recording removal of %s as rename to %s '
660 '(%d%% similar)\n') % 659 '(%d%% similar)\n') %
661 (oldrel, newrel, score * 100)) 660 (oldrel, newrel, score * 100))
662 if not dry_run: 661 if not dry_run:
663 repo.copy(old, new, wlock=wlock) 662 repo.copy(old, new)
664 663
665 def service(opts, parentfn=None, initfn=None, runfn=None): 664 def service(opts, parentfn=None, initfn=None, runfn=None):
666 '''Run a command as a service.''' 665 '''Run a command as a service.'''
667 666
668 if opts['daemon'] and not opts['daemon_pipefds']: 667 if opts['daemon'] and not opts['daemon_pipefds']: