Add get_peeled to BaseRepo so HTTP and git servers use one call to peel tags.
authorDave Borowitz <dborowitz@google.com>
Mon, 1 Mar 2010 17:48:41 +0000 (09:48 -0800)
committerDave Borowitz <dborowitz@google.com>
Thu, 4 Mar 2010 17:50:05 +0000 (09:50 -0800)
commit5ddf56897aba540e3a5d07ffcf9fafc078241d14
tree4a7982f1acb0397818e0f38f4008b7a0d4db2365
parentd1de8cd78da88e38bb89f0fbe8177d7b45555069
Add get_peeled to BaseRepo so HTTP and git servers use one call to peel tags.

This method needs to go in BaseRepo rather than ObjectStore so it can take
advantage of the cached peeled values in the packed-refs file, which belongs
to the RefsContainer. To this end, added a similar get_peeled method to
RefsContainer that accesses the peeled ref cache. Unlike BaseRepo.get_peeled,
RefsContainer.get_peeled returns None if peeled ref information is not cached
(since it does not have access to an ObjectStore to do the peeling itself).

Modified the TCP git server and dumb HTTP server to advertise peeled refs
consistently and correctly. Added tests for all new functionality.

Change-Id: I214ffee1a3459a746a7e34a1d04c0f527c5c8347
15 files changed:
dulwich/errors.py
dulwich/repo.py
dulwich/server.py
dulwich/tests/data/repos/a.git/objects/28/237f4dc30d0d462658d6b937b08a0f0b6ef55a [new file with mode: 0644]
dulwich/tests/data/repos/a.git/objects/b0/931cadc54336e78a1d980420e3268903b57a50 [new file with mode: 0644]
dulwich/tests/data/repos/a.git/packed-refs [new file with mode: 0644]
dulwich/tests/data/repos/a.git/refs/tags/mytag [new file with mode: 0644]
dulwich/tests/data/repos/refs.git/objects/3e/c9c43c84ff242e3ef4a9fc5bc111fd780a76a8 [new file with mode: 0644]
dulwich/tests/data/repos/refs.git/objects/cd/a609072918d7b70057b6bef9f4c2537843fcfe [new file with mode: 0644]
dulwich/tests/data/repos/refs.git/packed-refs
dulwich/tests/data/repos/refs.git/refs/tags/refs-0.2 [new file with mode: 0644]
dulwich/tests/test_repository.py
dulwich/tests/test_server.py
dulwich/tests/test_web.py
dulwich/web.py