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