68
class GitBranch(ForeignBranch):
67
class GitBranch(branch.Branch):
69
68
"""An adapter to git repositories for bzr Branch objects."""
71
def __init__(self, bzrdir, repository, name, head, lockfiles):
70
def __init__(self, bzrdir, repository, head, base, lockfiles):
72
71
self.repository = repository
73
super(GitBranch, self).__init__(default_mapping)
72
super(GitBranch, self).__init__()
74
73
self.control_files = lockfiles
75
74
self.bzrdir = bzrdir
78
self.base = bzrdir.transport.base
79
77
self._format = GitBranchFormat()
81
79
def lock_write(self):
82
80
self.control_files.lock_write()
84
def get_stacked_on_url(self):
85
# Git doesn't do stacking (yet...)
89
"""See Branch.get_parent()."""
93
self.control_files.lock_read()
96
self.control_files.unlock()
98
def get_physical_lock_status(self):
102
class LocalGitBranch(GitBranch):
105
83
def last_revision(self):
106
84
# perhaps should escape this ?
107
85
if self.head is None:
108
86
return revision.NULL_REVISION
109
return self.mapping.revision_id_foreign_to_bzr(self.head)
87
return default_mapping.revision_id_foreign_to_bzr(self.head)
111
89
def _make_tags(self):
112
90
return GitTagDict(self)
93
"""See Branch.get_parent()."""
96
def get_stacked_on_url(self):
114
99
def _gen_revision_history(self):
115
100
if self.head is None:
117
ret = list(self.repository.iter_reverse_revision_history(self.last_revision()))
108
cms = self.repository._git.commits(self.head, max_count=max_count, skip=skip)
112
ret.append(default_mapping.revision_id_foreign_to_bzr(cm.id))
116
nextid = cm.parents[0].id
121
120
def get_config(self):
122
121
return GitBranchConfig(self)
124
self.control_files.lock_read()
127
self.control_files.unlock()
129
def get_physical_lock_status(self):
124
132
def get_push_location(self):
125
133
"""See Branch.get_push_location."""
126
134
push_loc = self.get_config().get_user_option('push_location')