~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2006-02-15 08:11:37 UTC
  • mto: (1534.1.24 integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060215081137-4c27377517e96dd1
Make format 4/5/6 branches share a single LockableFiles instance across wt/branch/repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
502
502
        """Return the ASCII format string that identifies this format."""
503
503
        raise NotImplementedError(self.get_format_string)
504
504
 
505
 
    def _find_modes(self, t):
506
 
        """Determine the appropriate modes for files and directories.
507
 
        
508
 
        FIXME: When this merges into, or from storage,
509
 
        this code becomes delgatable to a LockableFiles instance.
510
 
 
511
 
        For now its cribbed and returns (dir_mode, file_mode)
512
 
        """
513
 
        try:
514
 
            st = t.stat('.')
515
 
        except errors.TransportNotPossible:
516
 
            dir_mode = 0755
517
 
            file_mode = 0644
518
 
        else:
519
 
            dir_mode = st.st_mode & 07777
520
 
            # Remove the sticky and execute bits for files
521
 
            file_mode = dir_mode & ~07111
522
 
        if not BzrBranch._set_dir_mode:
523
 
            dir_mode = None
524
 
        if not BzrBranch._set_file_mode:
525
 
            file_mode = None
526
 
        return dir_mode, file_mode
527
 
 
528
505
    def initialize(self, a_bzrdir):
529
506
        """Create a branch of this format in a_bzrdir."""
530
507
        raise NotImplementedError(self.initialized)
597
574
        if not _found:
598
575
            # we are being called directly and must probe.
599
576
            raise NotImplementedError
600
 
        transport = a_bzrdir.get_branch_transport(self)
601
 
        control_files = LockableFiles(transport, 'branch-lock')
602
577
        return BzrBranch(_format=self,
603
 
                         _control_files=control_files,
 
578
                         _control_files=a_bzrdir._control_files,
604
579
                         a_bzrdir=a_bzrdir,
605
580
                         _repository=a_bzrdir.open_repository())
606
581