/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/transform.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-07-27 23:53:10 UTC
  • mfrom: (7356.1.10 exitstack)
  • Revision ID: breezy.the.bot@gmail.com-20190727235310-ccs69jhu4pq55qsi
Use contextlib.ExitStack rather than our homegrown OperationWithCleanups.

Merged from https://code.launchpad.net/~jelmer/brz/exitstack/+merge/369203

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from breezy import (
34
34
    annotate,
35
35
    bencode,
 
36
    cleanup,
36
37
    controldir,
37
38
    commit,
38
39
    conflicts,
2598
2599
    :param delta_from_tree: If true, build_tree may use the input Tree to
2599
2600
        generate the inventory delta.
2600
2601
    """
2601
 
    with wt.lock_tree_write(), tree.lock_read():
 
2602
    with cleanup.ExitStack() as exit_stack:
 
2603
        exit_stack.enter_context(wt.lock_tree_write())
 
2604
        exit_stack.enter_context(tree.lock_read())
2602
2605
        if accelerator_tree is not None:
2603
 
            accelerator_tree.lock_read()
2604
 
        try:
2605
 
            return _build_tree(tree, wt, accelerator_tree, hardlink,
2606
 
                               delta_from_tree)
2607
 
        finally:
2608
 
            if accelerator_tree is not None:
2609
 
                accelerator_tree.unlock()
 
2606
            exit_stack.enter_context(accelerator_tree.lock_read())
 
2607
        return _build_tree(tree, wt, accelerator_tree, hardlink,
 
2608
                           delta_from_tree)
2610
2609
 
2611
2610
 
2612
2611
def _build_tree(tree, wt, accelerator_tree, hardlink, delta_from_tree):