/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 bzrlib/branch.py

Merge from bzr.ab.integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
23
import sys
24
24
from unittest import TestSuite
25
25
from warnings import warn
26
 
try:
27
 
    import xml.sax.saxutils
28
 
except ImportError:
29
 
    raise ImportError("We were unable to import 'xml.sax.saxutils',"
30
 
                      " most likely you have an xml.pyc or xml.pyo file"
31
 
                      " lying around in your bzrlib directory."
32
 
                      " Please remove it.")
33
 
 
34
26
 
35
27
import bzrlib
36
28
import bzrlib.bzrdir as bzrdir
48
40
import bzrlib.inventory as inventory
49
41
from bzrlib.inventory import Inventory
50
42
from bzrlib.lockable_files import LockableFiles, TransportLock
 
43
from bzrlib.lockdir import LockDir
51
44
from bzrlib.osutils import (isdir, quotefn,
52
45
                            rename, splitpath, sha_file,
53
46
                            file_kind, abspath, normpath, pathjoin,
660
653
    This format has:
661
654
     - a revision-history file.
662
655
     - a format string
663
 
     - a lock file.
 
656
     - a lock dir guarding the branch itself
 
657
     - all of this stored in a branch/ subdirectory
664
658
     - works with shared repositories.
 
659
 
 
660
    This format is new in bzr 0.8.
665
661
    """
666
662
 
667
663
    def get_format_string(self):
670
666
        
671
667
    def initialize(self, a_bzrdir):
672
668
        """Create a branch of this format in a_bzrdir."""
673
 
        mutter('creating branch in %s', a_bzrdir.transport.base)
 
669
        mutter('creating branch %r in %s', self, a_bzrdir.transport.base)
674
670
        branch_transport = a_bzrdir.get_branch_transport(self)
675
 
 
676
671
        utf8_files = [('revision-history', ''),
677
672
                      ('branch-name', ''),
678
673
                      ]
679
 
        control_files = LockableFiles(branch_transport, 'lock', TransportLock)
 
674
        control_files = LockableFiles(branch_transport, 'lock', LockDir)
680
675
        control_files.create_lock()
681
676
        control_files.lock_write()
682
677
        control_files.put_utf8('format', self.get_format_string())
701
696
            format = BranchFormat.find_format(a_bzrdir)
702
697
            assert format.__class__ == self.__class__
703
698
        transport = a_bzrdir.get_branch_transport(None)
704
 
        control_files = LockableFiles(transport, 'lock', TransportLock)
 
699
        control_files = LockableFiles(transport, 'lock', LockDir)
705
700
        return BzrBranch5(_format=self,
706
701
                          _control_files=control_files,
707
702
                          a_bzrdir=a_bzrdir,