diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2012-08-30 00:57:51 +0200 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2012-08-30 00:57:51 +0200 |
commit | 995746780863781d73b9e4ad1e1149844f6a1a85 (patch) | |
tree | 915e5acca0e7e5ee98c42e3b709a61e78dc83808 /rhodecode/lib/vcs/backends/git/changeset.py | |
parent | 7618715e609f2b60577de52a9136454d999214f0 (diff) |
re implemented affected_files function for git using dulwich
it speeds up things like 70%
--HG--
branch : beta
Diffstat (limited to 'rhodecode/lib/vcs/backends/git/changeset.py')
-rw-r--r-- | rhodecode/lib/vcs/backends/git/changeset.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/rhodecode/lib/vcs/backends/git/changeset.py b/rhodecode/lib/vcs/backends/git/changeset.py index 91970376..c4cfa7e9 100644 --- a/rhodecode/lib/vcs/backends/git/changeset.py +++ b/rhodecode/lib/vcs/backends/git/changeset.py @@ -410,14 +410,27 @@ class GitChangeset(BaseChangeset): """ Get's a fast accessible file changes for given changeset """ - - return self.added + self.changed + #OLD SOLUTION + #files = set() + #for f in (self.added + self.changed + self.removed): + # files.add(f.path) + #files = list(files) + + _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) |