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/03/28 20:13:37 UTC

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

Updated Branches:
  refs/heads/cj/5879 [created] 31e53c447


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

Branch: refs/heads/cj/5879
Commit: 31e53c44797ccf1d5e51f198c3b5b51c271f8c00
Parents: 6f44f8a
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 19:09:46 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 19:09:49 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/31e53c44/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index c660d69..1c59b52 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/31e53c44/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/31e53c44/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/31e53c44/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/31e53c44/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/31e53c44/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..78d1bc9 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -244,6 +244,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
+
 
 class TestGitCommit(unittest.TestCase):