Show More
@@ -66,26 +66,13 b' class GitChangeset(BaseChangeset):' | |||||
66 |
|
66 | |||
67 | @LazyProperty |
|
67 | @LazyProperty | |
68 | def branch(self): |
|
68 | def branch(self): | |
69 | # TODO: Cache as we walk (id <-> branch name mapping) |
|
69 | ||
70 |
|
|
70 | heads = self.repository._heads(reverse=False) | |
71 | heads = {} |
|
|||
72 | for key, val in refs.items(): |
|
|||
73 | for ref_key in ['refs/heads/', 'refs/remotes/origin/']: |
|
|||
74 | if key.startswith(ref_key): |
|
|||
75 | n = key[len(ref_key):] |
|
|||
76 | if n not in ['HEAD']: |
|
|||
77 | heads[n] = val |
|
|||
78 |
|
71 | |||
79 | for name, id in heads.iteritems(): |
|
72 | ref = heads.get(self.raw_id) | |
80 | walker = self.repository._repo.object_store.get_graph_walker([id]) |
|
73 | if ref: | |
81 | while True: |
|
74 | return safe_unicode(ref) | |
82 | id_ = walker.next() |
|
75 | ||
83 | if not id_: |
|
|||
84 | break |
|
|||
85 | if id_ == self.id: |
|
|||
86 | return safe_unicode(name) |
|
|||
87 | raise ChangesetError("This should not happen... Have you manually " |
|
|||
88 | "change id of the changeset?") |
|
|||
89 |
|
76 | |||
90 | def _fix_path(self, path): |
|
77 | def _fix_path(self, path): | |
91 | """ |
|
78 | """ |
@@ -246,6 +246,19 b' class GitRepository(BaseRepository):' | |||||
246 | if ref.startswith('refs/heads/') and not ref.endswith('/HEAD')] |
|
246 | if ref.startswith('refs/heads/') and not ref.endswith('/HEAD')] | |
247 | return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) |
|
247 | return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) | |
248 |
|
248 | |||
|
249 | def _heads(self, reverse=False): | |||
|
250 | refs = self._repo.get_refs() | |||
|
251 | heads = {} | |||
|
252 | ||||
|
253 | for key, val in refs.items(): | |||
|
254 | for ref_key in ['refs/heads/', 'refs/remotes/origin/']: | |||
|
255 | if key.startswith(ref_key): | |||
|
256 | n = key[len(ref_key):] | |||
|
257 | if n not in ['HEAD']: | |||
|
258 | heads[n] = val | |||
|
259 | ||||
|
260 | return heads if reverse else dict((y,x) for x,y in heads.iteritems()) | |||
|
261 | ||||
249 | def _get_tags(self): |
|
262 | def _get_tags(self): | |
250 | if not self.revisions: |
|
263 | if not self.revisions: | |
251 | return {} |
|
264 | return {} |
@@ -91,7 +91,7 b'' | |||||
91 | %if len(cs.parents)>1: |
|
91 | %if len(cs.parents)>1: | |
92 | <span class="merge">${_('merge')}</span> |
|
92 | <span class="merge">${_('merge')}</span> | |
93 | %endif |
|
93 | %endif | |
94 |
%if |
|
94 | %if cs.branch: | |
95 | <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}"> |
|
95 | <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}"> | |
96 | ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span> |
|
96 | ${h.link_to(h.shorter(cs.branch),h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span> | |
97 | %endif |
|
97 | %endif |
General Comments 0
You need to be logged in to leave comments.
Login now