diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2012-04-17 21:44:26 +0200 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2012-04-17 21:44:26 +0200 |
commit | 1c4ef941418105f1201b6c68e2cb96e649bc6799 (patch) | |
tree | 5bb9cbe52d6c4efda6936ec4a0a191cb286bd27e /rhodecode/lib/vcs/backends/git/changeset.py | |
parent | e1848bc4bfcadc736831d50076c55d0bd1512986 (diff) |
display current heads of branches for git in changelog and shortlog
--HG--
branch : beta
Diffstat (limited to 'rhodecode/lib/vcs/backends/git/changeset.py')
-rw-r--r-- | rhodecode/lib/vcs/backends/git/changeset.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/rhodecode/lib/vcs/backends/git/changeset.py b/rhodecode/lib/vcs/backends/git/changeset.py index c527de7f..b909f579 100644 --- a/rhodecode/lib/vcs/backends/git/changeset.py +++ b/rhodecode/lib/vcs/backends/git/changeset.py @@ -66,26 +66,13 @@ class GitChangeset(BaseChangeset): @LazyProperty def branch(self): - # TODO: Cache as we walk (id <-> branch name mapping) - refs = self.repository._repo.get_refs() - heads = {} - for key, val in refs.items(): - for ref_key in ['refs/heads/', 'refs/remotes/origin/']: - if key.startswith(ref_key): - n = key[len(ref_key):] - if n not in ['HEAD']: - heads[n] = val - - for name, id in heads.iteritems(): - walker = self.repository._repo.object_store.get_graph_walker([id]) - while True: - id_ = walker.next() - if not id_: - break - if id_ == self.id: - return safe_unicode(name) - raise ChangesetError("This should not happen... Have you manually " - "change id of the changeset?") + + heads = self.repository._heads(reverse=False) + + ref = heads.get(self.raw_id) + if ref: + return safe_unicode(ref) + def _fix_path(self, path): """ |