Explorar el Código

Simplify get_parents

milki hace 11 años
padre
commit
65794a9c53
Se han modificado 1 ficheros con 3 adiciones y 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.