Explorar o código

Simplify get_parents

milki %!s(int64=11) %!d(string=hai) anos
pai
achega
65794a9c53
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      dulwich/repo.py

+ 3 - 3
dulwich/repo.py

@@ -329,10 +329,10 @@ class BaseRepo(object):
         :return: List of parents
         """
 
-        if sha in self.graftpoints:
+        try:
             return self.graftpoints[sha]
-        else:
-            return self.commit(sha).parents
+        except KeyError:
+            return self[sha].parents
 
     def get_config(self):
         """Retrieve the config object.