/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 dir.py

Add simple HACKING document.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
16
16
 
17
 
"""An adapter between a Git control dir and a Bazaar BzrDir"""
 
17
"""An adapter between a Git control dir and a Bazaar BzrDir."""
18
18
 
19
19
import os
20
20
 
27
27
    )
28
28
 
29
29
lazy_import(globals(), """
30
 
from bzrlib.lockable_files import TransportLock
 
30
from bzrlib.lockable_files import (
 
31
    TransportLock,
 
32
    )
31
33
from bzrlib.plugins.git import (
32
34
    errors,
33
35
    branch,
 
36
    get_rich_root_format,
34
37
    repository,
35
38
    workingtree,
36
39
    )
66
69
        self._lock = lock
67
70
        self._transaction = None
68
71
        self._lock_mode = None
 
72
        self._transport = transport
69
73
        self._lock_count = 0
70
 
        self._transport = transport
71
74
 
72
75
 
73
76
class GitDir(bzrdir.BzrDir):
77
80
        return True
78
81
 
79
82
    def cloning_metadir(self, stacked=False):
80
 
        return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
 
83
        return get_rich_root_format()
81
84
 
82
85
 
83
86
class LocalGitDir(GitDir):
108
111
    def open_branch(self, ignored=None):
109
112
        """'create' a branch for this dir."""
110
113
        repo = self.open_repository()
111
 
        return branch.LocalGitBranch(self, repo, "HEAD", repo._git.head(), self._lockfiles)
 
114
        return branch.LocalGitBranch(self, repo, "HEAD", repo._git.head(),
 
115
            self._lockfiles)
112
116
 
113
117
    def open_repository(self, shared=False):
114
118
        """'open' a repository for this dir."""
115
119
        return self._gitrepository_class(self, self._lockfiles)
116
120
 
117
121
    def open_workingtree(self, recommend_upgrade=True):
 
122
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
 
123
        raise errors.bzr_errors.NoWorkingTree(loc)
118
124
        if (not self._git.bare and 
119
125
            os.path.exists(os.path.join(self._git.controldir(), "index"))):
120
126
            return workingtree.GitWorkingTree(self, self.open_repository(), 
121
127
                                                  self.open_branch())
122
 
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
123
 
        raise errors.bzr_errors.NoWorkingTree(loc)
124
128
 
125
129
    def create_repository(self, shared=False):
126
130
        return self.open_repository()