incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [05/50] [abbrv] git commit: [#5879] Fixed ordering of all_commit_ids for ForgeGit to ensure repo root always comes last
Date Thu, 04 Apr 2013 18:37:07 GMT
[#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 <cjohns@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/db/5453
Commit: db0d23fc0662641ab63147cf9e40619a74894410
Parents: c736689
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Thu Mar 28 19:09:46 2013 +0000
Committer: Cory Johns <cjohns@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, [{


Mime
View raw message