Merge Dave.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 7 Mar 2010 16:40:58 +0000 (17:40 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 7 Mar 2010 16:40:58 +0000 (17:40 +0100)
1  2 
NEWS
dulwich/server.py
dulwich/tests/test_server.py
dulwich/tests/test_web.py
dulwich/web.py

diff --cc NEWS
index 18b4df27b1c0772fff4763fc3e30a146beba8729,18b4df27b1c0772fff4763fc3e30a146beba8729..6c2d153ffad13bb3a746f37da5c70ae7e87cbf35
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -1,3 -1,3 +1,21 @@@
++0.5.1 UNRELEASED
++
++ BUG FIXES
++ 
++  * Fix ReceivePackHandler to disallow removing refs without delete-refs.
++    (Dave Borowitz)
++
++  * Deal with capabilities required by the client, even if they 
++    can not be disabled in the server. (Dave Borowitz)
++
++ FEATURES
++
++  * Add include-tag capability to server. (Dave Borowitz)
++
++ TESTS
++
++  * Add framework for testing compatibility with C Git. (Dave Borowitz)
++
  0.5.0 2010-03-03
  
   BUG FIXES
Simple merge
index b9e26167e431d1c29adb3878360356e268fad9f1,76d3c9790cee33e8d8e18b664a4a405d44ad32b4..bae4ece3584d94aba76d05c692407d5386d6ecfd
@@@ -40,9 -45,9 +40,10 @@@ TWO = '2' * 4
  THREE = '3' * 40
  FOUR = '4' * 40
  FIVE = '5' * 40
+ SIX = '6' * 40
  
  class TestProto(object):
 +
      def __init__(self):
          self._output = []
          self._received = {0: [], 1: [], 2: [], 3: []}
@@@ -127,9 -142,33 +140,34 @@@ class UploadPackHandlerTestCase(TestCas
          self._handler.progress('second message')
          self.assertEqual(None, self._handler.proto.get_received_line(2))
  
+     def test_get_tagged(self):
+         refs = {
+             'refs/tags/tag1': ONE,
+             'refs/tags/tag2': TWO,
+             'refs/heads/master': FOUR,  # not a tag, no peeled value
+             }
+         peeled = {
+             'refs/tags/tag1': '1234',
+             'refs/tags/tag2': '5678',
+             }
+         class TestRepo(object):
+             def get_peeled(self, ref):
+                 return peeled.get(ref, refs[ref])
+         caps = list(self._handler.required_capabilities()) + ['include-tag']
+         self._handler.set_client_capabilities(caps)
+         self.assertEquals({'1234': ONE, '5678': TWO},
+                           self._handler.get_tagged(refs, repo=TestRepo()))
+         # non-include-tag case
+         caps = self._handler.required_capabilities()
+         self._handler.set_client_capabilities(caps)
+         self.assertEquals({}, self._handler.get_tagged(refs, repo=TestRepo()))
  
  class TestCommit(object):
 +
      def __init__(self, sha, parents, commit_time):
          self.id = sha
          self._parents = parents
          return '%s(%s)' % (self.__class__.__name__, self._sha)
  
  
+ class TestRepo(object):
+     def __init__(self):
+         self.peeled = {}
+     def get_peeled(self, name):
+         return self.peeled[name]
  class TestBackend(object):
-     def __init__(self, objects):
 +
+     def __init__(self, repo, objects):
+         self.repo = repo
          self.object_store = objects
  
  
  class TestUploadPackHandler(Handler):
 +
      def __init__(self, objects, proto):
-         self.backend = TestBackend(objects)
+         self.backend = TestBackend(TestRepo(), objects)
          self.proto = proto
          self.stateless_rpc = False
          self.advertise_refs = False
Simple merge
diff --cc dulwich/web.py
index f14e95c2e7947dd0f23a193326a319dc70c2bdef,678b2e056ce6279dda160a9b3f619902a119122d..eec6587a7c5aa3d50d9bee2fd0b88677d18b2743
@@@ -23,11 -23,12 +23,7 @@@ import cg
  import re
  import time
  
- from dulwich.objects import (
-     Tag,
-     num_type_map,
 -from dulwich.repo import (
 -    Repo,
--    )
  from dulwich.server import (
 -    GitBackend,
      ReceivePackHandler,
      UploadPackHandler,
      )
@@@ -185,9 -180,9 +175,10 @@@ class _LengthLimitedFile(object)
  
      # TODO: support more methods as necessary
  
- def handle_service_request(req, backend, mat, services=services):
++
+ def handle_service_request(req, backend, mat, services=None):
      if services is None:
-         services = services
+         services = default_services
      service = mat.group().lstrip('/')
      handler_cls = services.get(service, None)
      if handler_cls is None: