incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [4/7] git commit: [#5775] ticket:433 Don't traverse all commits when just second needed
Date Wed, 02 Oct 2013 16:29:48 GMT
[#5775] ticket:433 Don't traverse all commits when just second needed


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/baed2859
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/baed2859
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/baed2859

Branch: refs/heads/master
Commit: baed28595e097eb8fc4b1ab51fdbee93065c92a4
Parents: 7ed43a9
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Oct 1 11:30:20 2013 +0300
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Oct 2 15:40:30 2013 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/baed2859/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index cb16763..fa62c23 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -313,9 +313,12 @@ class GitImplementation(M.RepositoryImplementation):
                 if path:
                     if renamed and renamed['to'] == path:
                         rename_details['path'] = '/' + renamed['from']
-                        revisions = [revision for revision in self._git.iter_commits(revs,
renamed['from'])]
+                        # get first rev **before** rename
+                        _iter = self._git.iter_commits(revs, renamed['from'])
+                        prev_rev = next(_iter)
+                        prev_rev = next(_iter)
                         rename_details['commit_url'] = self._repo.url_for_commit(
-                            revisions[1].hexsha
+                            prev_rev.hexsha
                         )
 
                     try:


Mime
View raw message