Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 4917: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 | 97b734fb9c6f |
children | 4106dde15aed |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Jul 21 16:02:10 2007 -0500 +++ b/mercurial/commands.py Sat Jul 21 16:02:10 2007 -0500 @@ -466,7 +466,7 @@ except ValueError, inst: raise util.Abort(str(inst)) -def docopy(ui, repo, pats, opts, wlock): +def docopy(ui, repo, pats, opts): # called with the repo lock held # # hgsep => pathname that uses "/" to separate directories @@ -527,14 +527,14 @@ try: restore = repo.dirstate[abstarget] == 'r' if restore and not opts.get('dry_run'): - repo.undelete([abstarget], wlock) + repo.undelete([abstarget]) try: if not opts.get('dry_run'): util.copyfile(src, target) restore = False finally: if restore: - repo.remove([abstarget], wlock=wlock) + repo.remove([abstarget]) except IOError, inst: if inst.errno == errno.ENOENT: ui.warn(_('%s: deleted in working copy\n') % relsrc) @@ -553,9 +553,9 @@ "data will be stored for %s.\n") % (repo.pathto(origsrc, cwd), reltarget)) if abstarget not in repo.dirstate and not opts.get('dry_run'): - repo.add([abstarget], wlock) + repo.add([abstarget]) elif not opts.get('dry_run'): - repo.copy(origsrc, abstarget, wlock) + repo.copy(origsrc, abstarget) copied.append((abssrc, relsrc, exact)) # pat: ossep @@ -677,7 +677,7 @@ """ wlock = repo.wlock(False) try: - errs, copied = docopy(ui, repo, pats, opts, wlock) + errs, copied = docopy(ui, repo, pats, opts) finally: del wlock return errs @@ -1627,7 +1627,7 @@ p2 = repo.lookup(p2 or hex(nullid)) if p1 != wp[0].node(): - hg.clean(repo, p1, wlock=wlock) + hg.clean(repo, p1) repo.dirstate.setparents(p1, p2) elif p2: try: @@ -1645,12 +1645,11 @@ fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, files=files) finally: - files = patch.updatedir(ui, repo, files, wlock=wlock) - n = repo.commit(files, message, user, date, wlock=wlock, - lock=lock) + files = patch.updatedir(ui, repo, files) + n = repo.commit(files, message, user, date) if opts.get('exact'): if hex(n) != nodeid: - repo.rollback(wlock=wlock, lock=lock) + repo.rollback() raise util.Abort(_('patch is damaged' + ' or loses information')) finally: @@ -2261,14 +2260,14 @@ """ wlock = repo.wlock(False) try: - errs, copied = docopy(ui, repo, pats, opts, wlock) + errs, copied = docopy(ui, repo, pats, opts) names = [] for abs, rel, exact in copied: if ui.verbose or not exact: ui.status(_('removing %s\n') % rel) names.append(abs) if not opts.get('dry_run'): - repo.remove(names, True, wlock=wlock) + repo.remove(names, True) return errs finally: del wlock @@ -2359,7 +2358,7 @@ names[abs] = (rel, exact) target_only[abs] = True - changes = repo.status(match=names.has_key, wlock=wlock)[:5] + changes = repo.status(match=names.has_key)[:5] modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) revert = ([], _('reverting %s\n')) @@ -2432,7 +2431,7 @@ if not opts.get('dry_run'): for f in forget[0]: repo.dirstate.forget(f) - r = hg.revert(repo, node, update.has_key, wlock) + r = hg.revert(repo, node, update.has_key) for f in add[0]: repo.dirstate.add(f) for f in undelete[0]: