Преглед на файлове

Support quiet capability.

Jelmer Vernooij преди 9 години
родител
ревизия
262804b20a
променени са 4 файла, в които са добавени 11 реда и са изтрити 4 реда
  1. 2 0
      NEWS
  2. 5 1
      dulwich/client.py
  3. 2 1
      dulwich/server.py
  4. 2 2
      dulwich/tests/test_porcelain.py

+ 2 - 0
NEWS

@@ -4,6 +4,8 @@
 
   * Add support for agent= capability. (Jelmer Vernooij, #298)
 
+  * Add support for quiet capability. (Jelmer Vernooij)
+
 0.11.1	2015-09-13
 
  Fix-up release to exclude broken blame.py file.

+ 5 - 1
dulwich/client.py

@@ -26,6 +26,7 @@ The Dulwich client supports the following capabilities:
  * multi_ack
  * side-band-64k
  * ofs-delta
+ * quiet
  * report-status
  * delete-refs
 
@@ -67,6 +68,7 @@ from dulwich.protocol import (
     CAPABILITY_MULTI_ACK,
     CAPABILITY_MULTI_ACK_DETAILED,
     CAPABILITY_OFS_DELTA,
+    CAPABILITY_QUIET,
     CAPABILITY_REPORT_STATUS,
     CAPABILITY_SIDE_BAND_64K,
     CAPABILITY_THIN_PACK,
@@ -185,7 +187,7 @@ class GitClient(object):
 
     """
 
-    def __init__(self, thin_packs=True, report_activity=None):
+    def __init__(self, thin_packs=True, report_activity=None, quiet=False):
         """Create a new GitClient instance.
 
         :param thin_packs: Whether or not thin packs should be retrieved
@@ -198,6 +200,8 @@ class GitClient(object):
         self._fetch_capabilities.add(capability_agent())
         self._send_capabilities = set(SEND_CAPABILITIES)
         self._send_capabilities.add(capability_agent())
+        if quiet:
+            self._send_capabilities.add(CAPABILITY_QUIET)
         if not thin_packs:
             self._fetch_capabilities.remove(CAPABILITY_THIN_PACK)
 

+ 2 - 1
dulwich/server.py

@@ -76,6 +76,7 @@ from dulwich.protocol import (
     CAPABILITY_NO_DONE,
     CAPABILITY_NO_PROGRESS,
     CAPABILITY_OFS_DELTA,
+    CAPABILITY_QUIET,
     CAPABILITY_REPORT_STATUS,
     CAPABILITY_SHALLOW,
     CAPABILITY_SIDE_BAND_64K,
@@ -839,7 +840,7 @@ class ReceivePackHandler(Handler):
 
     @classmethod
     def capabilities(cls):
-        return (CAPABILITY_REPORT_STATUS, CAPABILITY_DELETE_REFS,
+        return (CAPABILITY_REPORT_STATUS, CAPABILITY_DELETE_REFS, CAPABILITY_QUIET,
                 CAPABILITY_OFS_DELTA, CAPABILITY_SIDE_BAND_64K, CAPABILITY_NO_DONE)
 
     def _apply_pack(self, refs):

+ 2 - 2
dulwich/tests/test_porcelain.py

@@ -652,8 +652,8 @@ class ReceivePackTests(PorcelainTestCase):
         exitcode = porcelain.receive_pack(self.repo.path, BytesIO(b"0000"), outf)
         outlines = outf.getvalue().splitlines()
         self.assertEqual([
-            b'006d9e65bdcf4a22cdd4f3700604a275cd2aaf146b23 HEAD\x00 report-status '
-            b'delete-refs ofs-delta side-band-64k no-done',
+            b'00739e65bdcf4a22cdd4f3700604a275cd2aaf146b23 HEAD\x00 report-status '
+            b'delete-refs quiet ofs-delta side-band-64k no-done',
             b'003f9e65bdcf4a22cdd4f3700604a275cd2aaf146b23 refs/heads/master',
             b'0000'], outlines)
         self.assertEqual(0, exitcode)