You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/03 19:26:42 UTC

[13/46] git commit: [#5978] Fixed empty LCD info from double iteration of result set

[#5978] Fixed empty LCD info from double iteration of result set

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


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

Branch: refs/heads/cj/5879
Commit: 9110fed627d5f6fdc7ccebbcea60ec848a43eb0f
Parents: 53635e7
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Mar 29 16:54:53 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Mar 29 17:14:55 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py                      |    2 +-
 ForgeGit/forgegit/tests/model/test_repository.py |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9110fed6/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 85fa875..4d396b8 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -533,7 +533,7 @@ class Tree(RepoObject):
         if lcd is None:
             return []
         commit_ids = [e.commit_id for e in lcd.entries]
-        commits = Commit.query.find(dict(_id={'$in': commit_ids}))
+        commits = list(Commit.query.find(dict(_id={'$in': commit_ids})))
         for commit in commits:
             commit.set_context(self.repo)
         commit_infos = {c._id: c.info for c in commits}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9110fed6/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 4e1d417..6258251 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -2,6 +2,7 @@ import os
 import shutil
 import unittest
 import pkg_resources
+import datetime
 
 import mock
 from pylons import tmpl_context as c, app_globals as g
@@ -244,6 +245,21 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         self.repo.tarball('HEAD')
         assert os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
 
+    def test_ls(self):
+        lcd_map = self.repo.commit('HEAD').tree.ls()
+        self.assertEqual(lcd_map, [{
+                'href': u'README',
+                'kind': 'BLOB',
+                'last_commit': {
+                    'author': u'Rick Copeland',
+                    'author_email': u'rcopeland@geek.net',
+                    'author_url': None,
+                    'date': datetime.datetime(2010, 10, 7, 18, 44, 11),
+                    'href': u'/p/test/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/',
+                    'shortlink': u'[1e146e]',
+                    'summary': u'Change README'},
+                'name': u'README'}])
+
 
 class TestGitCommit(unittest.TestCase):