You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/05/29 12:11:25 UTC
allura git commit: Clone fork repo before retrieving commits for
merge request
Repository: allura
Updated Branches:
refs/heads/shared_clone [created] fc732f222
Clone fork repo before retrieving commits for merge request
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fc732f22
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fc732f22
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fc732f22
Branch: refs/heads/shared_clone
Commit: fc732f22248b8e8257f0b1f7e51423e4a91c8183
Parents: d9ce2a4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 29 10:10:42 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri May 29 10:10:42 2015 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/fc732f22/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index aeb5734..3edbd12 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -21,6 +21,7 @@ import string
import logging
import tempfile
from datetime import datetime
+from contextlib import contextmanager
import tg
import git
@@ -631,6 +632,14 @@ class GitImplementation(M.RepositoryImplementation):
'total': total,
}
+ @contextmanager
+ def _shared_clone(self, from_path):
+ tmp_path = tempfile.mkdtemp()
+ self._git.git.clone('--shared', from_path, tmp_path)
+ tmp_repo = GitImplementation(Object(full_fs_path=tmp_path))
+ yield tmp_repo
+ shutil.rmtree(tmp_path, ignore_errors=True)
+
def merge_base(self, mr):
g = self._git.git
g.fetch(mr.app.repo.full_fs_path, mr.target_branch)
@@ -642,11 +651,17 @@ class GitImplementation(M.RepositoryImplementation):
Must be called within mr.push_downstream_context()
"""
- base = self.merge_base(mr)
- return list(c.app.repo.log(
- mr.downstream.commit_id,
- exclude=base,
- id_only=False))
+ with self._shared_clone(self._repo.full_fs_path) as tmp_repo:
+ base = tmp_repo.merge_base(mr)
+ return list(tmp_repo.log(
+ [mr.downstream.commit_id],
+ exclude=[base],
+ id_only=False))
+ #base = self.merge_base(mr)
+ #return list(c.app.repo.log(
+ #mr.downstream.commit_id,
+ #exclude=base,
+ #id_only=False))
class _OpenedGitBlob(object):