Page MenuHomePhabricator

fold: use context manager for locks and transaction

Authored by pulkit on Oct 17 2017, 8:14 PM.


Diff Detail

rFBHGX Facebook Mercurial Extensions
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Oct 17 2017, 8:14 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 17 2017, 8:14 PM
mjpieters requested changes to this revision.Oct 19 2017, 9:46 AM
mjpieters added a subscriber: mjpieters.
mjpieters added inline comments.

This swaps the order of the transaction being entered and the foldcheck being done. I suspect this order matters. Creating a transaction is certainly quite involved, if the foldcheck fails we can avoid all that cost.

Please add a separate with repo.transaction('fold') as tr: after the _foldcheck(...) line.

This revision now requires changes to proceed.Oct 19 2017, 9:46 AM
pulkit added inline comments.Oct 19 2017, 7:49 PM

Macro goodcatch:

pulkit updated this revision to Diff 3138.Oct 27 2017, 6:04 PM
durham accepted this revision.Oct 31 2017, 1:02 PM
This revision was automatically updated to reflect the committed changes.