dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00167
[PATCH 1/7] Factor out _report_status in ReceivePackHandler.
From: Dave Borowitz <dborowitz@xxxxxxxxxx>
Change-Id: Ib0829d6a8817518625a1a3f06392d77f04862c2d
---
NEWS | 2 ++
dulwich/server.py | 19 +++++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/NEWS b/NEWS
index ed45ff6..350255b 100644
--- 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
diff --git a/dulwich/server.py b/dulwich/server.py
index f4a3dbc..f70fb66 100644
--- a/dulwich/server.py
+++ b/dulwich/server.py
@@ -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.
--
1.7.1
References