소스 검색

Add convenience function for parsing info/refs file.

Jelmer Vernooij 15 년 전
부모
커밋
1ad5b1c06a
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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.