Explorar o código

Add convenience function for parsing info/refs file.

Jelmer Vernooij %!s(int64=15) %!d(string=hai) anos
pai
achega
1ad5b1c06a
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      dulwich/repo.py

+ 8 - 0
dulwich/repo.py

@@ -70,6 +70,14 @@ BASE_DIRECTORIES = [
     ]
 
 
+def read_info_refs(f):
+    ret = {}
+    for l in f.readlines():
+        (sha, name) = l.rstrip("\n").split("\t", 1)
+        ret[name] = sha
+    return ret
+
+
 def check_ref_format(refname):
     """Check if a refname is correctly formatted.