# HG changeset patch # User Siddharth Agarwal # Date 1384794545 28800 # Node ID 04eaa8eec6a07912891763e80b463cc2cac493fb # Parent 80d8bd69b5db3c571b08fb464506dbc0fa332a3a strip.stripcmd: remove redundant wlock acquire/release Now that we acquire and release a wlock in the outer scope, this is redundant. diff -r 80d8bd69b5db -r 04eaa8eec6a0 hgext/strip.py --- a/hgext/strip.py Mon Nov 25 12:18:29 2013 -0600 +++ b/hgext/strip.py Mon Nov 18 09:09:05 2013 -0800 @@ -182,33 +182,28 @@ revs = sorted(rootnodes) if update and opts.get('keep'): - wlock = repo.wlock() - try: - urev, p2 = repo.changelog.parents(revs[0]) - if (util.safehasattr(repo, 'mq') and p2 != nullid - and p2 in [x.node for x in repo.mq.applied]): - urev = p2 - uctx = repo[urev] + urev, p2 = repo.changelog.parents(revs[0]) + if (util.safehasattr(repo, 'mq') and p2 != nullid + and p2 in [x.node for x in repo.mq.applied]): + urev = p2 + uctx = repo[urev] - # only reset the dirstate for files that would actually change - # between the working context and uctx - descendantrevs = repo.revs("%s::." % uctx.rev()) - changedfiles = [] - for rev in descendantrevs: - # blindly reset the files, regardless of what actually - # changed - changedfiles.extend(repo[rev].files()) + # only reset the dirstate for files that would actually change + # between the working context and uctx + descendantrevs = repo.revs("%s::." % uctx.rev()) + changedfiles = [] + for rev in descendantrevs: + # blindly reset the files, regardless of what actually changed + changedfiles.extend(repo[rev].files()) - # reset files that only changed in the dirstate too - dirstate = repo.dirstate - dirchanges = [f for f in dirstate if dirstate[f] != 'n'] - changedfiles.extend(dirchanges) + # reset files that only changed in the dirstate too + dirstate = repo.dirstate + dirchanges = [f for f in dirstate if dirstate[f] != 'n'] + changedfiles.extend(dirchanges) - repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) - repo.dirstate.write() - update = False - finally: - wlock.release() + repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) + repo.dirstate.write() + update = False if opts.get('bookmark'): if mark == repo._bookmarkcurrent: