/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

Default to using global user id rather than making one up.

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
 
21
21
import bzrlib
22
 
from bzrlib.lazy_import import lazy_import
23
22
from bzrlib import (
24
23
    bzrdir,
25
24
    lockable_files,
26
25
    urlutils,
27
26
    )
28
27
 
29
 
lazy_import(globals(), """
30
 
from bzrlib.lockable_files import TransportLock
 
28
LockWarner = getattr(lockable_files, "_LockWarner", None)
 
29
 
31
30
from bzrlib.plugins.git import (
 
31
    LocalGitBzrDirFormat,
 
32
    branch,
32
33
    errors,
33
 
    branch,
 
34
    get_rich_root_format,
34
35
    repository,
35
36
    workingtree,
36
37
    )
37
 
""")
38
 
 
39
 
from bzrlib.plugins.git import LocalGitBzrDirFormat
40
 
 
41
38
 
42
39
 
43
40
class GitLock(object):
66
63
        self._lock = lock
67
64
        self._transaction = None
68
65
        self._lock_mode = None
69
 
        self._lock_count = 0
70
66
        self._transport = transport
 
67
        if LockWarner is None:
 
68
            # Bzr 1.13
 
69
            self._lock_count = 0
 
70
        else:
 
71
            self._lock_warner = LockWarner(repr(self))
71
72
 
72
73
 
73
74
class GitDir(bzrdir.BzrDir):
77
78
        return True
78
79
 
79
80
    def cloning_metadir(self, stacked=False):
80
 
        return bzrlib.bzrdir.format_registry.make_bzrdir("1.9-rich-root")
 
81
        return get_rich_root_format(stacked)
81
82
 
82
83
 
83
84
class LocalGitDir(GitDir):
94
95
        else:
95
96
            self.transport = transport.clone('.git')
96
97
        self._lockfiles = lockfiles
 
98
        self._mode_check_done = None
 
99
 
 
100
    def is_control_filename(self, filename):
 
101
        return filename == '.git' or filename.startswith('.git/')
97
102
 
98
103
    def get_branch_transport(self, branch_format):
99
104
        if branch_format is None:
105
110
    get_repository_transport = get_branch_transport
106
111
    get_workingtree_transport = get_branch_transport
107
112
 
108
 
    def open_branch(self, ignored=None):
 
113
    def open_branch(self, ignore_fallbacks=None):
109
114
        """'create' a branch for this dir."""
110
115
        repo = self.open_repository()
111
 
        return branch.LocalGitBranch(self, repo, "HEAD", repo._git.head(), self._lockfiles)
 
116
        return branch.LocalGitBranch(self, repo, "HEAD", self._lockfiles)
112
117
 
113
118
    def open_repository(self, shared=False):
114
119
        """'open' a repository for this dir."""
124
129
 
125
130
    def create_repository(self, shared=False):
126
131
        return self.open_repository()
 
132
 
 
133
    def create_branch(self):
 
134
        return self.open_branch()