# HG changeset patch # User Pierre-Yves David # Date 1407371848 25200 # Node ID 186b72e41294f96458eb6a54ed739e4fb3df7feb # Parent facb5efa8ea4ebffeeab2522e2bfd0ff913b805d evolve: drop useless wlock in rewrite diff -r facb5efa8ea4 -r 186b72e41294 hgext/evolve.py --- a/hgext/evolve.py Wed Aug 06 16:55:41 2014 -0700 +++ b/hgext/evolve.py Wed Aug 06 17:37:28 2014 -0700 @@ -767,72 +767,67 @@ base = old.p1() updatebookmarks = _bookmarksupdater(repo, old.node()) - wlock = repo.wlock() - try: - - # commit a new version of the old changeset, including the update - # collect all files which might be affected - files = set(old.files()) - for u in updates: - files.update(u.files()) - - # Recompute copies (avoid recording a -> b -> a) - copied = copies.pathcopies(base, head) - - - # prune files which were reverted by the updates - def samefile(f): - if f in head.manifest(): - a = head.filectx(f) - if f in base.manifest(): - b = base.filectx(f) - return (a.data() == b.data() - and a.flags() == b.flags()) - else: - return False + # commit a new version of the old changeset, including the update + # collect all files which might be affected + files = set(old.files()) + for u in updates: + files.update(u.files()) + + # Recompute copies (avoid recording a -> b -> a) + copied = copies.pathcopies(base, head) + + + # prune files which were reverted by the updates + def samefile(f): + if f in head.manifest(): + a = head.filectx(f) + if f in base.manifest(): + b = base.filectx(f) + return (a.data() == b.data() + and a.flags() == b.flags()) else: - return f not in base.manifest() - files = [f for f in files if not samefile(f)] - # commit version of these files as defined by head - headmf = head.manifest() - def filectxfn(repo, ctx, path): - if path in headmf: - fctx = head[path] - flags = fctx.flags() - mctx = memfilectx(repo, fctx.path(), fctx.data(), - islink='l' in flags, - isexec='x' in flags, - copied=copied.get(path)) - return mctx - raise IOError() - - message = cmdutil.logmessage(repo.ui, commitopts) - if not message: - message = old.description() - - user = commitopts.get('user') or old.user() - date = commitopts.get('date') or None # old.date() - extra = dict(commitopts.get('extra', {})) - extra['branch'] = head.branch() - - new = context.memctx(repo, - parents=newbases, - text=message, - files=files, - filectxfn=filectxfn, - user=user, - date=date, - extra=extra) - - if commitopts.get('edit'): - new._text = cmdutil.commitforceeditor(repo, new, []) - revcount = len(repo) - newid = repo.commitctx(new) - new = repo[newid] - created = len(repo) != revcount - updatebookmarks(newid) - finally: - wlock.release() + return False + else: + return f not in base.manifest() + files = [f for f in files if not samefile(f)] + # commit version of these files as defined by head + headmf = head.manifest() + def filectxfn(repo, ctx, path): + if path in headmf: + fctx = head[path] + flags = fctx.flags() + mctx = memfilectx(repo, fctx.path(), fctx.data(), + islink='l' in flags, + isexec='x' in flags, + copied=copied.get(path)) + return mctx + raise IOError() + + message = cmdutil.logmessage(repo.ui, commitopts) + if not message: + message = old.description() + + user = commitopts.get('user') or old.user() + date = commitopts.get('date') or None # old.date() + extra = dict(commitopts.get('extra', {})) + extra['branch'] = head.branch() + + new = context.memctx(repo, + parents=newbases, + text=message, + files=files, + filectxfn=filectxfn, + user=user, + date=date, + extra=extra) + + if commitopts.get('edit'): + new._text = cmdutil.commitforceeditor(repo, new, []) + revcount = len(repo) + newid = repo.commitctx(new) + new = repo[newid] + created = len(repo) != revcount + updatebookmarks(newid) return newid, created