/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: 2017-08-29 21:29:35 UTC
  • mfrom: (6754.8.21 lock-context-2)
  • mto: This revision was merged to the branch mainline in revision 6784.
  • Revision ID: jelmer@jelmer.uk-20170829212935-lakl2jhq9sqckejp
Merge lock-context-2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    commit,
38
38
    conflicts,
39
39
    delta,
 
40
    lock,
40
41
    multiparent,
41
42
    osutils,
42
43
    revision as _mod_revision,
1551
1552
        TreeTransform.apply() called).
1552
1553
        """
1553
1554
        tree.lock_tree_write()
1554
 
 
1555
1555
        try:
1556
1556
            limbodir = urlutils.local_path_from_url(
1557
1557
                tree._transport.abspath('limbo'))
2046
2046
 
2047
2047
    def lock_read(self):
2048
2048
        # Perhaps in theory, this should lock the TreeTransform?
2049
 
        return self
 
2049
        return lock.LogicalLockResult(self.unlock)
2050
2050
 
2051
2051
    def unlock(self):
2052
2052
        pass
2527
2527
    :param delta_from_tree: If true, build_tree may use the input Tree to
2528
2528
        generate the inventory delta.
2529
2529
    """
2530
 
    wt.lock_tree_write()
2531
 
    try:
2532
 
        tree.lock_read()
 
2530
    with wt.lock_tree_write(), tree.lock_read():
 
2531
        if accelerator_tree is not None:
 
2532
            accelerator_tree.lock_read()
2533
2533
        try:
 
2534
            return _build_tree(tree, wt, accelerator_tree, hardlink,
 
2535
                               delta_from_tree)
 
2536
        finally:
2534
2537
            if accelerator_tree is not None:
2535
 
                accelerator_tree.lock_read()
2536
 
            try:
2537
 
                return _build_tree(tree, wt, accelerator_tree, hardlink,
2538
 
                                   delta_from_tree)
2539
 
            finally:
2540
 
                if accelerator_tree is not None:
2541
 
                    accelerator_tree.unlock()
2542
 
        finally:
2543
 
            tree.unlock()
2544
 
    finally:
2545
 
        wt.unlock()
 
2538
                accelerator_tree.unlock()
2546
2539
 
2547
2540
 
2548
2541
def _build_tree(tree, wt, accelerator_tree, hardlink, delta_from_tree):