--- a/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800
+++ b/mercurial/commands.py Fri Jan 15 13:14:46 2016 -0800
@@ -3386,13 +3386,10 @@
r1 = scmutil.revsingle(repo, rev1).node()
r2 = scmutil.revsingle(repo, rev2, 'null').node()
- wlock = repo.wlock()
- try:
+ with repo.wlock():
repo.dirstate.beginparentchange()
repo.setparents(r1, r2)
repo.dirstate.endparentchange()
- finally:
- wlock.release()
@command('debugdirstate|debugstate',
[('', 'nodates', None, _('do not display the saved mtime')),