##// END OF EJS Templates
localrepo: use context manager for lock and transaction in commitctx()...
Martin von Zweigbergk -
r41400:0132221c default
parent child Browse files
Show More
@@ -2502,13 +2502,10 b' class localrepository(object):'
2502 from p1 or p2 are excluded from the committed ctx.files().
2502 from p1 or p2 are excluded from the committed ctx.files().
2503 """
2503 """
2504
2504
2505 tr = None
2506 p1, p2 = ctx.p1(), ctx.p2()
2505 p1, p2 = ctx.p1(), ctx.p2()
2507 user = ctx.user()
2506 user = ctx.user()
2508
2507
2509 lock = self.lock()
2508 with self.lock(), self.transaction("commit") as tr:
2510 try:
2511 tr = self.transaction("commit")
2512 trp = weakref.proxy(tr)
2509 trp = weakref.proxy(tr)
2513
2510
2514 if ctx.manifestnode():
2511 if ctx.manifestnode():
@@ -2605,12 +2602,7 b' class localrepository(object):'
2605 #
2602 #
2606 # if minimal phase was 0 we don't need to retract anything
2603 # if minimal phase was 0 we don't need to retract anything
2607 phases.registernew(self, tr, targetphase, [n])
2604 phases.registernew(self, tr, targetphase, [n])
2608 tr.close()
2609 return n
2605 return n
2610 finally:
2611 if tr:
2612 tr.release()
2613 lock.release()
2614
2606
2615 @unfilteredmethod
2607 @unfilteredmethod
2616 def destroying(self):
2608 def destroying(self):
General Comments 0
You need to be logged in to leave comments. Login now