~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Robert Collins
  • Date: 2006-03-25 02:38:14 UTC
  • mto: (1666.1.5 integration)
  • mto: This revision was merged to the branch mainline in revision 1671.
  • Revision ID: robertc@robertcollins.net-20060325023814-2e444ad46b0b25bf
Reduce lock thrashing somewhat - drops bound branch tests lock count from 6554 to 4456 locks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1489
1489
        transport = a_bzrdir.get_workingtree_transport(self)
1490
1490
        control_files = self._open_control_files(a_bzrdir)
1491
1491
        control_files.create_lock()
 
1492
        control_files.lock_write()
1492
1493
        control_files.put_utf8('format', self.get_format_string())
1493
1494
        branch = a_bzrdir.open_branch()
1494
1495
        if revision_id is None:
1501
1502
                         _format=self,
1502
1503
                         _bzrdir=a_bzrdir,
1503
1504
                         _control_files=control_files)
1504
 
        wt._write_inventory(inv)
1505
 
        wt.set_root_id(inv.root.file_id)
1506
 
        wt.set_last_revision(revision_id)
1507
 
        wt.set_pending_merges([])
1508
 
        build_tree(wt.basis_tree(), wt)
 
1505
        wt.lock_write()
 
1506
        try:
 
1507
            wt._write_inventory(inv)
 
1508
            wt.set_root_id(inv.root.file_id)
 
1509
            wt.set_last_revision(revision_id)
 
1510
            wt.set_pending_merges([])
 
1511
            build_tree(wt.basis_tree(), wt)
 
1512
        finally:
 
1513
            wt.unlock()
 
1514
            control_files.unlock()
1509
1515
        return wt
1510
1516
 
1511
1517
    def __init__(self):