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:29:26 UTC

[1/3] git commit: [#5879] Fixed ordering of all_commit_ids for ForgeGit to ensure repo root always comes last

Updated Branches:
  refs/heads/master c73668930 -> 5eb6d368d


[#5879] Fixed ordering of all_commit_ids for ForgeGit to ensure repo root always comes last

The performance of refresh_last_commits depends on the repo root being
processed first and the commits following in roughly story (a.k.a.
topological) order.  If the commits are processed out of order, it has
to walk back up the tree a *lot* more to reconstruct last-commit data
that it otherwise gets for "free" (having already computed it).

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/db0d23fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/db0d23fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/db0d23fc

Branch: refs/heads/master
Commit: db0d23fc0662641ab63147cf9e40619a74894410
Parents: c736689
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 19:09:46 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 3 17:26:02 2013 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py                |    9 ++++-----
 .../5c/47243c8e424136fd5cdd18cd94d34c66d1955c      |    3 +++
 .../5c/891311e2b402f3f86eabf1688b5496183d9f94      |  Bin 0 -> 24 bytes
 .../b1/42cbffd81acd7c57b47bf64fbb9e0920d82c55      |  Bin 0 -> 78 bytes
 .../forgegit/tests/data/testgit.git/refs/heads/zz  |    1 +
 ForgeGit/forgegit/tests/model/test_repository.py   |   11 +++++++++++
 6 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index d7c9d49..299ddb2 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -162,11 +162,10 @@ class GitImplementation(M.RepositoryImplementation):
         ending with the root (first commit).
         """
         seen = set()
-        for head in self._git.heads:
-            for ci in self._git.iter_commits(head, topo_order=True):
-                if ci.binsha in seen: continue
-                seen.add(ci.binsha)
-                yield ci.hexsha
+        for ci in self._git.iter_commits(all=True, topo_order=True):
+            if ci.binsha in seen: continue
+            seen.add(ci.binsha)
+            yield ci.hexsha
 
     def new_commits(self, all_commits=False):
         graph = {}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/47243c8e424136fd5cdd18cd94d34c66d1955c
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/47243c8e424136fd5cdd18cd94d34c66d1955c b/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/47243c8e424136fd5cdd18cd94d34c66d1955c
new file mode 100644
index 0000000..18fe11f
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/47243c8e424136fd5cdd18cd94d34c66d1955c
@@ -0,0 +1,3 @@
+x��M
+�0�]���i�Ӏ��΅wHf&�b:%�oo��o�����PJ��;��I�S�4����d|���w��h��Z���K��8v>����Fo�}pz�:$�>a4Q�w���M��2-��������D�
+�O(�zp�7Z�n���~������W�*��"�L�
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/891311e2b402f3f86eabf1688b5496183d9f94
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/891311e2b402f3f86eabf1688b5496183d9f94 b/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/891311e2b402f3f86eabf1688b5496183d9f94
new file mode 100644
index 0000000..5337266
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testgit.git/objects/5c/891311e2b402f3f86eabf1688b5496183d9f94 differ

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/ForgeGit/forgegit/tests/data/testgit.git/objects/b1/42cbffd81acd7c57b47bf64fbb9e0920d82c55
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testgit.git/objects/b1/42cbffd81acd7c57b47bf64fbb9e0920d82c55 b/ForgeGit/forgegit/tests/data/testgit.git/objects/b1/42cbffd81acd7c57b47bf64fbb9e0920d82c55
new file mode 100644
index 0000000..0e707ac
Binary files /dev/null and b/ForgeGit/forgegit/tests/data/testgit.git/objects/b1/42cbffd81acd7c57b47bf64fbb9e0920d82c55 differ

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/ForgeGit/forgegit/tests/data/testgit.git/refs/heads/zz
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/data/testgit.git/refs/heads/zz b/ForgeGit/forgegit/tests/data/testgit.git/refs/heads/zz
new file mode 100644
index 0000000..68c205a
--- /dev/null
+++ b/ForgeGit/forgegit/tests/data/testgit.git/refs/heads/zz
@@ -0,0 +1 @@
+5c47243c8e424136fd5cdd18cd94d34c66d1955c

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0d23fc/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 fbcfaa0..1102ee8 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -247,6 +247,17 @@ 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_all_commit_ids(self):
+        cids = list(self.repo.all_commit_ids())
+        heads = [
+                '1e146e67985dcd71c74de79613719bef7bddca4a',  # master
+                '5c47243c8e424136fd5cdd18cd94d34c66d1955c',  # zz
+            ]
+        self.assertIn(cids[0], heads)  # repo head comes first
+        for head in heads:
+            self.assertIn(head, cids)  # all branches included
+        self.assertEqual(cids[-1], '9a7df788cf800241e3bb5a849c8870f2f8259d98')  # repo root comes last
+
     def test_ls(self):
         lcd_map = self.repo.commit('HEAD').tree.ls()
         self.assertEqual(lcd_map, [{


[2/3] git commit: [#5879] Fixed error from all_commit_ids on empty git repo

Posted by jo...@apache.org.
[#5879] Fixed error from all_commit_ids on empty git repo

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/0531982a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0531982a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0531982a

Branch: refs/heads/master
Commit: 0531982a667b46d561f478e6f7685999f96aa5ab
Parents: db0d23f
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 21:35:36 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 3 17:26:03 2013 +0000

----------------------------------------------------------------------
 ForgeGit/forgegit/model/git_repo.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0531982a/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 299ddb2..e7d529f 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -161,6 +161,8 @@ class GitImplementation(M.RepositoryImplementation):
         """Yield commit ids, starting with the head(s) of the commit tree and
         ending with the root (first commit).
         """
+        if not self._git.head.is_valid():
+            return  # empty repo
         seen = set()
         for ci in self._git.iter_commits(all=True, topo_order=True):
             if ci.binsha in seen: continue


[3/3] git commit: [#5879] Fixed tests failing due to new commit in test repo

Posted by jo...@apache.org.
[#5879] Fixed tests failing due to new commit in test repo

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/5eb6d368
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5eb6d368
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5eb6d368

Branch: refs/heads/master
Commit: 5eb6d368d458e45a69ed3d15d1d9a9bd1f18e3b9
Parents: 0531982
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 21:35:51 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 3 17:26:03 2013 +0000

----------------------------------------------------------------------
 .../forgegit/tests/functional/test_controllers.py  |    6 +++---
 ForgeGit/forgegit/tests/model/test_repository.py   |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5eb6d368/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 1c8e0df..5be4d01 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -81,14 +81,14 @@ class TestRootController(_TestCase):
     def test_commit_browser_data(self):
         resp = self.app.get('/src-git/commit_browser_data')
         data = json.loads(resp.body);
-        assert data['max_row'] == 3
+        assert data['max_row'] == 4
         assert data['next_column'] == 1
         assert_equal(data['built_tree']['df30427c488aeab84b2352bdf88a3b19223f9d7a'],
                 {u'url': u'/p/test/src-git/ci/df30427c488aeab84b2352bdf88a3b19223f9d7a/',
                  u'oid': u'df30427c488aeab84b2352bdf88a3b19223f9d7a',
                  u'column': 0,
                  u'parents': [u'6a45885ae7347f1cac5103b0050cc1be6a1496c8'],
-                 u'message': u'Add README', u'row': 1})
+                 u'message': u'Add README', u'row': 2})
 
     def test_log(self):
         resp = self.app.get('/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/log/')
@@ -184,7 +184,7 @@ class TestRootController(_TestCase):
 
     def test_refresh(self):
         notification = M.Notification.query.find(
-            dict(subject='[test:src-git] 4 new commits to test Git')).first()
+            dict(subject='[test:src-git] 5 new commits to test Git')).first()
         domain = '.'.join(reversed(c.app.url[1:-1].split('/'))).replace('_', '-')
         common_suffix = tg.config.get('forgemail.domain', '.sourceforge.net')
         email = 'noreply@%s%s' % (domain, common_suffix)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5eb6d368/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 1102ee8..bce1a4f 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -56,7 +56,7 @@ class TestNewGit(unittest.TestCase):
         assert self.rev.tree._id == self.rev.tree_id
         assert self.rev.summary == self.rev.message.splitlines()[0]
         assert self.rev.shorthand_id() == '[1e146e]'
-        assert self.rev.symbolic_ids == (['master'], [])
+        assert self.rev.symbolic_ids == (['master', 'zz'], [])
         assert self.rev.url() == (
             '/p/test/src-git/ci/'
             '1e146e67985dcd71c74de79613719bef7bddca4a/')