/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: Jelmer Vernooij
  • Date: 2019-06-26 20:58:23 UTC
  • mto: This revision was merged to the branch mainline in revision 7378.
  • Revision ID: jelmer@jelmer.uk-20190626205823-ms7j2rgjd8oj0g97
Use ExitStack in more places.

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,
2601
2602
    :param delta_from_tree: If true, build_tree may use the input Tree to
2602
2603
        generate the inventory delta.
2603
2604
    """
2604
 
    with wt.lock_tree_write(), tree.lock_read():
 
2605
    with cleanup.ExitStack() as exit_stack:
 
2606
        exit_stack.enter_context(wt.lock_tree_write())
 
2607
        exit_stack.enter_context(tree.lock_read())
2605
2608
        if accelerator_tree is not None:
2606
 
            accelerator_tree.lock_read()
2607
 
        try:
2608
 
            return _build_tree(tree, wt, accelerator_tree, hardlink,
2609
 
                               delta_from_tree)
2610
 
        finally:
2611
 
            if accelerator_tree is not None:
2612
 
                accelerator_tree.unlock()
 
2609
            exit_stack.enter_context(accelerator_tree.lock_read())
 
2610
        return _build_tree(tree, wt, accelerator_tree, hardlink,
 
2611
                           delta_from_tree)
2613
2612
 
2614
2613
 
2615
2614
def _build_tree(tree, wt, accelerator_tree, hardlink, delta_from_tree):