Factor out _report_status in ReceivePackHandler.
authorDave Borowitz <dborowitz@google.com>
Fri, 14 May 2010 01:54:22 +0000 (18:54 -0700)
committerDave Borowitz <dborowitz@google.com>
Mon, 2 Aug 2010 16:10:37 +0000 (09:10 -0700)
Change-Id: Ib0829d6a8817518625a1a3f06392d77f04862c2d

NEWS
dulwich/server.py

diff --git a/NEWS b/NEWS
index ed45ff6..350255b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -87,6 +87,8 @@
 
   * Move reference WSGI handler to web.py. (Dave Borowitz)
 
+  * Factor out _report_status in ReceivePackHandler. (Dave Borowitz)
+
 
 0.6.0  2010-05-22
 
index f4a3dbc..f70fb66 100644 (file)
@@ -614,6 +614,16 @@ class ReceivePackHandler(Handler):
 
         return status
 
+    def _report_status(self, status):
+        for name, msg in status:
+            if name == 'unpack':
+                self.proto.write_pkt_line('unpack %s\n' % msg)
+            elif msg == 'ok':
+                self.proto.write_pkt_line('ok %s\n' % name)
+            else:
+                self.proto.write_pkt_line('ng %s %s\n' % (name, msg))
+        self.proto.write_pkt_line(None)
+
     def handle(self):
         refs = self.repo.get_refs().items()
 
@@ -654,14 +664,7 @@ class ReceivePackHandler(Handler):
         # when we have read all the pack from the client, send a status report
         # if the client asked for it
         if self.has_capability('report-status'):
-            for name, msg in status:
-                if name == 'unpack':
-                    self.proto.write_pkt_line('unpack %s\n' % msg)
-                elif msg == 'ok':
-                    self.proto.write_pkt_line('ok %s\n' % name)
-                else:
-                    self.proto.write_pkt_line('ng %s %s\n' % (name, msg))
-            self.proto.write_pkt_line(None)
+            self._report_status(status)
 
 
 # Default handler classes for git services.