Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 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 | 6b639caa1652 |
children | 6bce6d925e45 |
comparison
equal
deleted
inserted
replaced
27851:4133a306606c | 27852:a33c1c9e769c |
---|---|
1358 | 1358 |
1359 Return the same tuple as applyupdates(). | 1359 Return the same tuple as applyupdates(). |
1360 """ | 1360 """ |
1361 | 1361 |
1362 onode = node | 1362 onode = node |
1363 wlock = repo.wlock() | |
1364 # If we're doing a partial update, we need to skip updating | 1363 # If we're doing a partial update, we need to skip updating |
1365 # the dirstate, so make a note of any partial-ness to the | 1364 # the dirstate, so make a note of any partial-ness to the |
1366 # update here. | 1365 # update here. |
1367 if matcher is None or matcher.always(): | 1366 if matcher is None or matcher.always(): |
1368 partial = False | 1367 partial = False |
1369 else: | 1368 else: |
1370 partial = True | 1369 partial = True |
1371 try: | 1370 with repo.wlock(): |
1372 wc = repo[None] | 1371 wc = repo[None] |
1373 pl = wc.parents() | 1372 pl = wc.parents() |
1374 p1 = pl[0] | 1373 p1 = pl[0] |
1375 pas = [None] | 1374 pas = [None] |
1376 if ancestor is not None: | 1375 if ancestor is not None: |
1539 util.unlink(repo.join('updatestate')) | 1538 util.unlink(repo.join('updatestate')) |
1540 | 1539 |
1541 if not branchmerge: | 1540 if not branchmerge: |
1542 repo.dirstate.setbranch(p2.branch()) | 1541 repo.dirstate.setbranch(p2.branch()) |
1543 repo.dirstate.endparentchange() | 1542 repo.dirstate.endparentchange() |
1544 finally: | |
1545 wlock.release() | |
1546 | 1543 |
1547 if not partial: | 1544 if not partial: |
1548 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) | 1545 repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) |
1549 return stats | 1546 return stats |
1550 | 1547 |