changeset 27852:a33c1c9e769c

with: use context manager in merge update
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 4133a306606c
children 9b8a5c6ac176
files mercurial/merge.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/merge.py	Fri Jan 15 13:14:49 2016 -0800
@@ -1360,7 +1360,6 @@
     """
 
     onode = node
-    wlock = repo.wlock()
     # If we're doing a partial update, we need to skip updating
     # the dirstate, so make a note of any partial-ness to the
     # update here.
@@ -1368,7 +1367,7 @@
         partial = False
     else:
         partial = True
-    try:
+    with repo.wlock():
         wc = repo[None]
         pl = wc.parents()
         p1 = pl[0]
@@ -1541,8 +1540,6 @@
             if not branchmerge:
                 repo.dirstate.setbranch(p2.branch())
             repo.dirstate.endparentchange()
-    finally:
-        wlock.release()
 
     if not partial:
         repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])