Mercurial > kallithea
changeset 2761:e64c64e2b8aa beta
re implemented affected_files function for git using dulwich
it speeds up things like 70%
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 30 Aug 2012 00:57:51 +0200 |
parents | fd5f2b217488 |
children | ba4fb9c441c6 |
files | rhodecode/lib/vcs/backends/git/changeset.py |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/changeset.py Thu Aug 30 00:03:48 2012 +0200 +++ b/rhodecode/lib/vcs/backends/git/changeset.py Thu Aug 30 00:57:51 2012 +0200 @@ -410,14 +410,27 @@ """ Get's a fast accessible file changes for given changeset """ + #OLD SOLUTION + #files = set() + #for f in (self.added + self.changed + self.removed): + # files.add(f.path) + #files = list(files) - return self.added + self.changed + _r = self.repository._repo + files = set() + for parent in self.parents: + changes = _r.object_store.tree_changes(_r[parent.raw_id].tree, + _r[self.raw_id].tree) + for (oldpath, newpath), (_, _), (_, _) in changes: + files.add(newpath or oldpath) + return list(files) @LazyProperty def _diff_name_status(self): output = [] for parent in self.parents: - cmd = 'diff --name-status %s %s --encoding=utf8' % (parent.raw_id, self.raw_id) + cmd = 'diff --name-status %s %s --encoding=utf8' % (parent.raw_id, + self.raw_id) so, se = self.repository.run_git_command(cmd) output.append(so.strip()) return '\n'.join(output)