Przeglądaj źródła

Move read_info_refs from dulwich.client to dulwich.refs.

Jelmer Vernooij 11 lat temu
rodzic
commit
aae3032cff
2 zmienionych plików z 14 dodań i 8 usunięć
  1. 3 8
      dulwich/client.py
  2. 11 0
      dulwich/refs.py

+ 3 - 8
dulwich/client.py

@@ -62,6 +62,9 @@ from dulwich.protocol import (
 from dulwich.pack import (
     write_pack_objects,
     )
+from dulwich.refs import (
+    read_info_refs,
+    )
 
 
 # Python 2.6.6 included these in urlparse.uses_netloc upstream. Do
@@ -154,14 +157,6 @@ def read_pkt_refs(proto):
     return refs, set(server_capabilities)
 
 
-def read_info_refs(f):
-    ret = {}
-    for l in f.readlines():
-        (sha, name) = l.rstrip("\r\n").split("\t", 1)
-        ret[name] = sha
-    return ret
-
-
 # TODO(durin42): this doesn't correctly degrade if the server doesn't
 # support some capabilities. This should work properly with servers
 # that don't support multi_ack.

+ 11 - 0
dulwich/refs.py

@@ -738,3 +738,14 @@ def write_packed_refs(f, packed_refs, peeled_refs=None):
         f.write('%s %s\n' % (packed_refs[refname], refname))
         if refname in peeled_refs:
             f.write('^%s\n' % peeled_refs[refname])
+
+
+def read_info_refs(f):
+    ret = {}
+    for l in f.readlines():
+        (sha, name) = l.rstrip("\r\n").split("\t", 1)
+        ret[name] = sha
+    return ret
+
+
+