You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/06/25 18:26:57 UTC
[01/10] allura git commit: Merge branches 'master' and 'master' of
https://git-wip-us.apache.org/repos/asf/allura
Repository: allura
Updated Branches:
refs/heads/master b71482774 -> 702043077
Merge branches 'master' and 'master' of https://git-wip-us.apache.org/repos/asf/allura
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c520d677
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c520d677
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c520d677
Branch: refs/heads/master
Commit: c520d677112bbd6842d4c56f7d57439e57be1684
Parents: 9d26281
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue Jun 16 13:51:43 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Tue Jun 16 13:51:43 2015 +0000
----------------------------------------------------------------------
----------------------------------------------------------------------
[03/10] allura git commit: [#7873] Added option to set cache for git
references - NEEDS INI
Posted by he...@apache.org.
[#7873] Added option to set cache for git references - NEEDS INI
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/22fc5d9b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/22fc5d9b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/22fc5d9b
Branch: refs/heads/master
Commit: 22fc5d9b9b957967ef6038d3fd684cb2f043528c
Parents: 646d665
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:08:26 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:35 2015 +0000
----------------------------------------------------------------------
Allura/development.ini | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/22fc5d9b/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 9146033..395b9a8 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -297,6 +297,12 @@ scm.repos.tarball.zip_binary = /usr/bin/zip
scm.import.retry_count = 50
scm.import.retry_sleep_secs = 5
+; When getting a list of valid references (branches/tags) from a repo, you can cache
+; the resaults in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
+; lists will be cached and served from cache on subsequent requests until reset by `repo_refresh`.
+; Set to 0 to cache all references. Remove entirely to cache nothing.
+repo_refs_cache_threshold = .5
+
; One-click merge is enabled by default, but can be turned off on for each type of repo
scm.merge.git.disabled = false
scm.merge.hg.disabled = false
[07/10] allura git commit: [#7873] Add tests for git branch/tag cache
system
Posted by he...@apache.org.
[#7873] Add tests for git branch/tag cache system
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2d21779f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2d21779f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2d21779f
Branch: refs/heads/master
Commit: 2d21779f522a94f8354f9110983fc0e97ebd5361
Parents: 2d54358
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:25:17 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/tests/functional/test_controllers.py | 5 ++++-
ForgeGit/forgegit/tests/model/test_repository.py | 11 +++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2d21779f/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 917f765..29c6453 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -390,7 +390,10 @@ class TestRootController(_TestCase):
def test_default_branch(self):
assert_equal(c.app.default_branch_name, 'master')
- c.app.repo.set_default_branch('zz')
+ vv = c.app.repo.set_default_branch('zz')
+ print('-' * 10)
+ print(vv)
+ print('-' * 10)
assert_equal(c.app.default_branch_name, 'zz')
c.app.repo.set_default_branch('master')
assert_equal(c.app.default_branch_name, 'master')
http://git-wip-us.apache.org/repos/asf/allura/blob/2d21779f/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 349efe6..47dc34d 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -728,6 +728,17 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
res_with_tmp = self.repo.merge_request_commits(mr)
assert_equals(res_without_tmp, res_with_tmp)
+ def test_cached_branches(self):
+ with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+ rev = GM.Repository.query.get(_id=self.repo['_id'])
+ branches = rev._impl._get_refs('branches')
+ assert_equal(rev.cached_branches, branches)
+
+ def test_cached_tags(self):
+ with mock.patch.dict('allura.lib.app_globals.config', {'repo_refs_cache_threshold': '0'}):
+ rev = GM.Repository.query.get(_id=self.repo['_id'])
+ tags = rev._impl._get_refs('tags')
+ assert_equal(rev.cached_tags, tags)
class TestGitImplementation(unittest.TestCase):
[05/10] allura git commit: [#7873] Clear cache for branches/tags on
repo_refresh
Posted by he...@apache.org.
[#7873] Clear cache for branches/tags on repo_refresh
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0e0de67e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0e0de67e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0e0de67e
Branch: refs/heads/master
Commit: 0e0de67ed1c9eaec2f5fd3a0bb4411be63b0c7db
Parents: 22fc5d9
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:12:17 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/repo_refresh.py | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/0e0de67e/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index fca220f..74e79ba 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -124,6 +124,15 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
if (i + 1) % 100 == 0:
log.info('Compute last commit info %d: %s', (i + 1), ci._id)
+ # Clear any existing caches for branches/tags
+ if repo.cached_branches:
+ repo.cached_branches = []
+ session(repo).flush()
+
+ if repo.cached_tags:
+ repo.cached_tags = []
+ session(repo).flush()
+
if not all_commits and not new_clone:
for commit in commit_ids:
new = repo.commit(commit)
[10/10] allura git commit: Merge branch 'hs/7873'
Posted by he...@apache.org.
Merge branch 'hs/7873'
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/70204307
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/70204307
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/70204307
Branch: refs/heads/master
Commit: 702043077cb0c3d68ba06e51cb2bf830124856c6
Parents: 91d225f f39410f
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Jun 25 16:03:19 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 16:03:19 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/repo_refresh.py | 13 ++++++
Allura/allura/model/repository.py | 2 +
Allura/development.ini | 6 +++
ForgeGit/forgegit/model/git_repo.py | 45 ++++++++++++++++++--
.../forgegit/tests/model/test_repository.py | 13 ++++++
5 files changed, 76 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[02/10] allura git commit: [#7873] Performance improvements when
accessing tags and branches in git
Posted by he...@apache.org.
[#7873] Performance improvements when accessing tags and branches in git
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/646d665c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/646d665c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/646d665c
Branch: refs/heads/master
Commit: 646d665c48a83f1fc7c40d850c58f18d818a3a93
Parents: b714827
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue May 5 13:47:19 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:34 2015 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/git_main.py | 2 +-
ForgeGit/forgegit/model/git_repo.py | 32 +++++++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/646d665c/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index 62fc0f7..bb19ec3 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -66,7 +66,7 @@ class ForgeGitApp(RepositoryApp):
def repo(self):
return GM.Repository.query.get(app_config_id=self.config._id)
- @property
+ @LazyProperty
def default_branch_name(self):
return self.repo.get_default_branch('master')
http://git-wip-us.apache.org/repos/asf/allura/blob/646d665c/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 416db33..d6e791c 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -533,6 +533,32 @@ class GitImplementation(M.RepositoryImplementation):
return False
@LazyProperty
+ def _is_valid(self):
+ """ Verifies the validity of the reference objects in the git database
+
+ Returns True if no issues are found. This allows us to bypass the individual testing of each ref
+ unless absolutely necessary.
+
+ :rtype: bool
+ """
+ try:
+ self._git.git.fsck(full=True)
+ return True
+ except git.GitCommandError as gce:
+ log.debug(u"Found inconsistency in {}: {}".format(self._repo.name, gce.stderr))
+ return False
+
+ def _get_refs(self, ref_list):
+ """ Returns a list of valid reference objects from the git database
+
+ :return: List of git ref objects.
+ :rtype: list
+ """
+ if self._is_valid:
+ return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list]
+ return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list if ref.is_valid()]
+
+ @LazyProperty
def head(self):
if not self._git or not self._git.heads:
return None
@@ -549,15 +575,15 @@ class GitImplementation(M.RepositoryImplementation):
@LazyProperty
def heads(self):
- return [Object(name=b.name, object_id=b.commit.hexsha) for b in self._git.heads if b.is_valid()]
+ return self._get_refs(self._git.heads)
@LazyProperty
def branches(self):
- return [Object(name=b.name, object_id=b.commit.hexsha) for b in self._git.branches if b.is_valid()]
+ return self._get_refs(self._git.branches)
@LazyProperty
def tags(self):
- return [Object(name=t.name, object_id=t.commit.hexsha) for t in self._git.tags if t.is_valid()]
+ return self._get_refs(self._git.tags)
def set_default_branch(self, name):
if not name:
[04/10] allura git commit: [#7873] Add fields to Repository for
storing reference cache
Posted by he...@apache.org.
[#7873] Add fields to Repository for storing reference cache
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/35d58999
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/35d58999
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/35d58999
Branch: refs/heads/master
Commit: 35d58999081c4fb2d7cdec61f79e4fd0c531c5e8
Parents: 0e0de67
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:14:38 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/35d58999/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 022343f..a3d574c 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -349,6 +349,8 @@ class Repository(Artifact, ActivityObject):
repo_tags = FieldProperty(S.Deprecated)
upstream_repo = FieldProperty(dict(name=str, url=str))
default_branch_name = FieldProperty(str)
+ cached_branches = FieldProperty([dict(name=str, object_id=str)])
+ cached_tags = FieldProperty([dict(name=str, object_id=str)])
def __init__(self, **kw):
if 'name' in kw and 'tool' in kw:
[09/10] allura git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/allura
Posted by he...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/allura
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/91d225f2
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/91d225f2
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/91d225f2
Branch: refs/heads/master
Commit: 91d225f211f22c11a295413b575513d35e4f2653
Parents: c520d67 b714827
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Thu Jun 25 14:43:38 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:43:38 2015 +0000
----------------------------------------------------------------------
Allura/allura/config/middleware.py | 8 ----
Allura/allura/controllers/project.py | 7 +++-
Allura/allura/lib/app_globals.py | 53 ++-----------------------
Allura/allura/lib/plugin.py | 1 -
Allura/allura/lib/zarkov_helpers.py | 39 ------------------
Allura/allura/model/project.py | 7 ----
Allura/allura/model/session.py | 7 ----
Allura/allura/tests/test_zarkov_helpers.py | 53 -------------------------
Allura/development.ini | 7 +---
Dockerfile | 2 +-
INSTALL.markdown | 6 +--
solr_config/Dockerfile | 2 +-
12 files changed, 15 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
[06/10] allura git commit: [#7873] Add a mongo cache backend to speed
up branches/tags
Posted by he...@apache.org.
[#7873] Add a mongo cache backend to speed up branches/tags
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2d54358b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2d54358b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2d54358b
Branch: refs/heads/master
Commit: 2d54358bcbe608ab453c17a9765909ffdc9c3a36
Parents: 35d5899
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Mon Jun 15 08:24:29 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/git_main.py | 2 +-
ForgeGit/forgegit/model/git_repo.py | 63 ++++++++++++++++++++------------
2 files changed, 40 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2d54358b/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index bb19ec3..62fc0f7 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -66,7 +66,7 @@ class ForgeGitApp(RepositoryApp):
def repo(self):
return GM.Repository.query.get(app_config_id=self.config._id)
- @LazyProperty
+ @property
def default_branch_name(self):
return self.repo.get_default_branch('master')
http://git-wip-us.apache.org/repos/asf/allura/blob/2d54358b/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index d6e791c..d9ede88 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -532,31 +532,45 @@ class GitImplementation(M.RepositoryImplementation):
except KeyError:
return False
- @LazyProperty
- def _is_valid(self):
- """ Verifies the validity of the reference objects in the git database
-
- Returns True if no issues are found. This allows us to bypass the individual testing of each ref
- unless absolutely necessary.
+ def _get_refs(self, field_name):
+ """ Returns a list of valid reference objects (branches or tags) from the git database
- :rtype: bool
+ :return: List of git ref objects.
+ :rtype: list
"""
+
+ cache_name = 'cached_' + field_name
+ cache = getattr(self._repo, cache_name, None)
+
+ if cache:
+ return cache
+
+ ref_list = getattr(self._git, field_name)
+
+ refs = []
+ start_time = time()
+ for ref in ref_list:
+ try:
+ hex_sha = ref.commit.hexsha
+ except ValueError:
+ log.debug(u"Found invalid sha: {}".format(ref))
+ continue
+ refs.append(Object(name=ref.name, object_id=hex_sha))
+ time_taken = time() - start_time
+
+ threshold = tg.config.get('repo_refs_cache_threshold')
try:
- self._git.git.fsck(full=True)
- return True
- except git.GitCommandError as gce:
- log.debug(u"Found inconsistency in {}: {}".format(self._repo.name, gce.stderr))
- return False
+ threshold = float(threshold) if threshold else None
+ except ValueError:
+ threshold = None
+ log.warn('Skipping reference caching - The value for config param '
+ '"repo_refs_cache_threshold" must be a float.')
- def _get_refs(self, ref_list):
- """ Returns a list of valid reference objects from the git database
+ if threshold is not None and time_taken > threshold:
+ setattr(self._repo, cache_name, refs)
+ session(self._repo).flush(self._repo)
- :return: List of git ref objects.
- :rtype: list
- """
- if self._is_valid:
- return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list]
- return [Object(name=ref.name, object_id=ref.commit.hexsha) for ref in ref_list if ref.is_valid()]
+ return refs
@LazyProperty
def head(self):
@@ -573,17 +587,18 @@ class GitImplementation(M.RepositoryImplementation):
return None # no valid heads
return self._git.head.commit.hexsha
- @LazyProperty
+ @property
def heads(self):
- return self._get_refs(self._git.heads)
+ """ In git, heads are just branches """
+ return self.branches
@LazyProperty
def branches(self):
- return self._get_refs(self._git.branches)
+ return self._get_refs('branches')
@LazyProperty
def tags(self):
- return self._get_refs(self._git.tags)
+ return self._get_refs('tags')
def set_default_branch(self, name):
if not name:
[08/10] allura git commit: [#7873] Pre-cache git branches/tags after
repo_refresh
Posted by he...@apache.org.
[#7873] Pre-cache git branches/tags after repo_refresh
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f39410f8
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f39410f8
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f39410f8
Branch: refs/heads/master
Commit: f39410f8cc7fc579866da16f6d51b3feb9ec6913
Parents: 2d21779
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Tue Jun 16 14:02:20 2015 -0400
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Jun 25 14:10:57 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/repo_refresh.py | 4 ++++
Allura/development.ini | 2 +-
ForgeGit/forgegit/model/git_repo.py | 8 +++-----
ForgeGit/forgegit/tests/functional/test_controllers.py | 5 +----
ForgeGit/forgegit/tests/model/test_repository.py | 2 ++
5 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 74e79ba..1ca82e8 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -132,6 +132,10 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
if repo.cached_tags:
repo.cached_tags = []
session(repo).flush()
+ # The first view can be expensive to cache,
+ # so we want to do it here instead of on the first view.
+ repo.get_branches()
+ repo.get_tags()
if not all_commits and not new_clone:
for commit in commit_ids:
http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 395b9a8..bb2ccab 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -298,7 +298,7 @@ scm.import.retry_count = 50
scm.import.retry_sleep_secs = 5
; When getting a list of valid references (branches/tags) from a repo, you can cache
-; the resaults in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
+; the results in mongo based on a threshold. Set `repo_refs_cache_threshold` (in seconds) and the resulting
; lists will be cached and served from cache on subsequent requests until reset by `repo_refresh`.
; Set to 0 to cache all references. Remove entirely to cache nothing.
repo_refs_cache_threshold = .5
http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index d9ede88..7d87a09 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -545,10 +545,9 @@ class GitImplementation(M.RepositoryImplementation):
if cache:
return cache
- ref_list = getattr(self._git, field_name)
-
refs = []
start_time = time()
+ ref_list = getattr(self._git, field_name)
for ref in ref_list:
try:
hex_sha = ref.commit.hexsha
@@ -587,10 +586,9 @@ class GitImplementation(M.RepositoryImplementation):
return None # no valid heads
return self._git.head.commit.hexsha
- @property
+ @LazyProperty
def heads(self):
- """ In git, heads are just branches """
- return self.branches
+ return self._get_refs('heads')
@LazyProperty
def branches(self):
http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 29c6453..917f765 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -390,10 +390,7 @@ class TestRootController(_TestCase):
def test_default_branch(self):
assert_equal(c.app.default_branch_name, 'master')
- vv = c.app.repo.set_default_branch('zz')
- print('-' * 10)
- print(vv)
- print('-' * 10)
+ c.app.repo.set_default_branch('zz')
assert_equal(c.app.default_branch_name, 'zz')
c.app.repo.set_default_branch('master')
assert_equal(c.app.default_branch_name, 'master')
http://git-wip-us.apache.org/repos/asf/allura/blob/f39410f8/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 47dc34d..c28daf1 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -746,6 +746,7 @@ class TestGitImplementation(unittest.TestCase):
repo_dir = pkg_resources.resource_filename(
'forgegit', 'tests/data/testgit.git')
repo = mock.Mock(full_fs_path=repo_dir)
+ repo.cached_branches = []
impl = GM.git_repo.GitImplementation(repo)
self.assertEqual(impl.branches, [
Object(name='master',
@@ -758,6 +759,7 @@ class TestGitImplementation(unittest.TestCase):
repo_dir = pkg_resources.resource_filename(
'forgegit', 'tests/data/testgit.git')
repo = mock.Mock(full_fs_path=repo_dir)
+ repo.cached_tags = []
impl = GM.git_repo.GitImplementation(repo)
self.assertEqual(impl.tags, [
Object(name='foo',