35
35
def get_tag_dict(self):
37
for k,v in self.repository._git.tags.iteritems():
38
ret[k] = self.branch.mapping.revision_id_foreign_to_bzr(v)
37
for tag in self.repository._git.tags:
38
ret[tag.name] = default_mapping.convert_revision_id_git_to_bzr(tag.commit.id)
41
41
def set_tag(self, name, revid):
42
self.repository._git.tags[name] = revid
42
raise NotImplementedError(self.set_tag)
45
45
class GitBranchConfig(config.BranchConfig):
67
class GitBranch(ForeignBranch):
67
class GitBranch(branch.Branch):
68
68
"""An adapter to git repositories for bzr Branch objects."""
70
def __init__(self, bzrdir, repository, name, head, lockfiles):
70
def __init__(self, bzrdir, repository, head, base, lockfiles):
71
71
self.repository = repository
72
super(GitBranch, self).__init__(repository.get_mapping())
72
super(GitBranch, self).__init__()
73
73
self.control_files = lockfiles
74
74
self.bzrdir = bzrdir
77
self.base = bzrdir.transport.base
78
77
self._format = GitBranchFormat()
80
79
def lock_write(self):
81
80
self.control_files.lock_write()
83
def get_stacked_on_url(self):
84
# Git doesn't do stacking (yet...)
88
"""See Branch.get_parent()."""
91
def set_parent(self, url):
95
self.control_files.lock_read()
98
self.control_files.unlock()
100
def get_physical_lock_status(self):
104
class LocalGitBranch(GitBranch):
107
83
def last_revision(self):
108
84
# perhaps should escape this ?
109
85
if self.head is None:
110
86
return revision.NULL_REVISION
111
return self.mapping.revision_id_foreign_to_bzr(self.head)
87
return default_mapping.convert_revision_id_git_to_bzr(self.head)
113
89
def _make_tags(self):
114
90
return GitTagDict(self)
93
"""See Branch.get_parent()."""
96
def get_stacked_on_url(self):
116
99
def _gen_revision_history(self):
117
100
if self.head is None:
119
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.convert_revision_id_git_to_bzr(cm.id))
116
nextid = cm.parents[0].id
123
120
def get_config(self):
124
121
return GitBranchConfig(self)
124
self.control_files.lock_read()
127
self.control_files.unlock()
129
def get_physical_lock_status(self):
126
132
def get_push_location(self):
127
133
"""See Branch.get_push_location."""
128
134
push_loc = self.get_config().get_user_option('push_location')