/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

Use new context stuff.

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,
2046
2047
 
2047
2048
    def lock_read(self):
2048
2049
        # Perhaps in theory, this should lock the TreeTransform?
2049
 
        return self
 
2050
        return lock.LogicalLockResult(self.unlock)
2050
2051
 
2051
2052
    def unlock(self):
2052
2053
        pass
2527
2528
    :param delta_from_tree: If true, build_tree may use the input Tree to
2528
2529
        generate the inventory delta.
2529
2530
    """
2530
 
    wt.lock_tree_write()
2531
 
    try:
2532
 
        tree.lock_read()
 
2531
    with wt.lock_tree_write(), tree.lock_read():
 
2532
        if accelerator_tree is not None:
 
2533
            accelerator_tree.lock_read()
2533
2534
        try:
 
2535
            return _build_tree(tree, wt, accelerator_tree, hardlink,
 
2536
                               delta_from_tree)
 
2537
        finally:
2534
2538
            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()
 
2539
                accelerator_tree.unlock()
2546
2540
 
2547
2541
 
2548
2542
def _build_tree(tree, wt, accelerator_tree, hardlink, delta_from_tree):